package cn.fl.project.controller;

import java.lang.reflect.Field;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cmm.comm.facade.framework.api.ISysDictionaryApiService;
import cmm.comm.facade.framework.condition.SysCtrlCfgQueryCondition;
import cmm.comm.facade.framework.dto.SysDictionaryDTO;
import cmm.comm.facade.upload.api.IUploadApiService;
import cmm.comm.facade.upload.condition.SysUlDatCfgQueryCondition;
import cmm.comm.facade.upload.condition.SysUlFilesRecQueryCondition;
import cmm.comm.facade.upload.constant.UploadConstant;
import cmm.comm.facade.upload.dto.SysUlDatCfgDTO;
import cmm.comm.facade.upload.dto.SysUlDatCfgDtlDTO;
import cmm.comm.facade.upload.dto.SysUlFilesRecDTO;
import cn.cmm.base.framework.logger.eum.LogExceptionEnum;
import cn.cmm.base.framework.logger.eum.LogOperEnum;
import cn.cmm.cache.framework.utils.PropertiesCacheUtils;
import cn.fl.spl.transform.SplCommPropInfoVOTransform;
import cn.fl.spl.vo.SplCommPropInfoVO;
import cn.fl.system.service.ISysCtrlCfgService;
import fl.constant.facade.framework.constant.BusinessIdConstant;
import fl.flow.facade.flow.dto.FlowStartedDTO;
import fl.flow.facade.flow.dto.SysFlowSHDTO;
import fl.spl.facade.carsguar.api.ISplCarsGuarDtlInfoApiService;
import fl.spl.facade.carsguar.condition.SplCarsGuarDtlInfoQC;
import fl.spl.facade.carsguar.dto.SplCarsGuarDtlInfoDTO;
import fl.spl.facade.crm.api.ISplDataStatisticsApiService;
import fl.spl.facade.framework.constant.SplSystemConstant;
import fl.spl.facade.framework.enums.CommonOpTypCdEnum;
import fl.spl.facade.framework.enums.LnkCompFileCfgEnum;
import fl.spl.facade.framework.enums.SplInfoFileCfgEnum;
import fl.spl.facade.lnkcomp.api.IPrjLnkCompQueryApiService;
import fl.spl.facade.lnkcomp.condition.LnkCompModDtlQC;
import fl.spl.facade.lnkcomp.condition.PrjLcApplyRlPsnQueryCondition;
import fl.spl.facade.lnkcomp.condition.PrjLnkCompApplyQueryCondition;
import fl.spl.facade.lnkcomp.condition.PrjLnkCompOrgRQC;
import fl.spl.facade.lnkcomp.condition.PrjLnkCompRlPsnQC;
import fl.spl.facade.lnkcomp.constant.PrjLnkCompRelInfoConstant;
import fl.spl.facade.lnkcomp.constant.LnkCompConstant;
import fl.spl.facade.lnkcomp.dto.LnkCompModDTO;
import fl.spl.facade.lnkcomp.dto.LnkCompModDtlDTO;
import fl.spl.facade.lnkcomp.dto.PrjLnkCompDTO;
import fl.spl.facade.spl.api.ISplCommPropInfoApiService;
import fl.spl.facade.spl.condition.SplCommPropInfoQC;
import fl.spl.facade.spl.constant.SplInfoConstant;
import fl.spl.facade.spl.dto.SplCommPropInfoDTO;
import net.sf.json.JSONArray;
import tc.relationmap.facade.relationmap.hsj.dto.HsjBasicDTO;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

import cmm.mid.core.framework.dto.DataResultDTO;
import cmm.mid.core.framework.page.DataResultVO;
import cmm.mid.core.framework.page.KeyValueVO;
import cmm.mid.core.framework.page.ListPageVO;
import cmm.mid.core.framework.page.Pager;
import cmm.web.core.framework.controller.BaseController;
import cn.cmm.base.framework.constant.BaseConstant;
import cn.cmm.base.framework.constant.BaseExceptionConstant;
import cn.cmm.base.framework.exception.BaseException;
import cn.cmm.base.framework.utils.BaseLogUtils;
import cn.cmm.base.framework.utils.CollectionUtils;
import cn.cmm.base.framework.utils.DateUtils;
import cn.cmm.base.framework.utils.StringUtils;
import cn.fl.base.lnkcomp.vo.BasePrjLnkCompRlPsnVO;
import cn.fl.customer.service.ICstBscInfoService;
import cn.fl.customer.vo.CstValidCardInfoVO;
import cn.fl.flow.service.IFlowService;
import cn.fl.framework.base.constant.WebBaseConstant;
import cn.fl.framework.base.context.CurrentThreadContext;
import cn.fl.framework.constant.DictionaryConstant;
import cn.fl.hsj.service.IHsjQueryService;
import cn.fl.project.service.ILnkCompModDtlService;
import cn.fl.project.service.ILnkCompModService;
import cn.fl.project.service.IPrjLcApplyRlPsnService;
import cn.fl.project.service.IPrjLnkCompApplyService;
import cn.fl.project.service.IPrjLnkCompOrgRService;
import cn.fl.project.service.IPrjLnkCompRlPsnService;
import cn.fl.project.service.IPrjLnkCompService;
import cn.fl.project.transform.PrjLnkCompRlPsnVOTransform;
import cn.fl.project.transform.PrjLnkCompVOTransform;
import cn.fl.project.vo.LnkCompModVO;
import cn.fl.project.vo.PrjFileInfoVO;
import cn.fl.project.vo.PrjLcApplyRlPsnVO;
import cn.fl.project.vo.PrjLnkCompApplyVO;
import cn.fl.project.vo.PrjLnkCompOrgRVO;
import cn.fl.project.vo.PrjLnkCompRlPsnVO;
import cn.fl.project.vo.PrjLnkCompVO;
import cn.fl.system.constant.SysLogConstant;
import cn.fl.system.service.ISysUlFilesRecService;
import cn.fl.system.vo.SysFlowManageVVO;
import cn.fl.system.vo.SysUlFilesRecVO;
import fl.flow.facade.flow.api.IFlowApiService;
import fl.flow.facade.flow.condition.SysFlowManageVQueryCondition;
import fl.flow.facade.flow.condition.SysFlowSHQueryCondition;
import fl.flow.facade.flow.constant.FlowConstant;
import fl.flow.facade.flow.dto.FlowStartParamsDTO;

/**
 * @Description: 挂靠公司变更申请表 控制层
 */
@Controller
@RequestMapping("/project/prjLnkCompApply")
public class PrjLnkCompApplyController extends BaseController {

	/**
	 * PrjLnkCompApply 服务层BEAN
	 */
	@Autowired
	private IPrjLnkCompApplyService prjLnkCompApplyService;

	@Autowired
	private IPrjLnkCompOrgRService prjLnkCompOrgRService;

	@Autowired
	private ICstBscInfoService cstBscInfoService;

	@Autowired
	private IPrjLnkCompService prjLnkCompService;

	@Autowired
	private IPrjLcApplyRlPsnService prjLcApplyRlPsnService;

	@Autowired
	private IPrjLnkCompRlPsnService prjLnkCompRlPsnService;

	@Autowired
	private IFlowApiService flowApiService;

	@Autowired
	private ISysDictionaryApiService sysDictionaryApiService;

	@Autowired
	private ILnkCompModService lnkCompModService ;

	@Autowired
	private ILnkCompModDtlService lnkCompModDtlService ;

	@Autowired
	private ISysUlFilesRecService sysUlFilesRecService ;

	@Autowired
	private IHsjQueryService hsjQueryService ;

	@Autowired
	private ISplDataStatisticsApiService splDataStatisticsApiService ;

	@Autowired
	private ISysCtrlCfgService sysCtrlCfgService;

	@Autowired
	private ISplCommPropInfoApiService splCommPropInfoApiService ;
	@Autowired
	private IUploadApiService uploadApiService ;
	@Autowired
	private ISplCarsGuarDtlInfoApiService splCarsGuarDtlInfoApiService ;


	/**
	 * 任务服务
	 */
	@Autowired
	private IFlowService flowService;
	

	@Autowired
	private IPrjLnkCompQueryApiService prjLnkCompQueryApiService ;
	/**
	 * 初始化挂靠公司变更记录页面数据toModifyPage.do
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/initList.do", method = { RequestMethod.GET })
	@ResponseBody
	public Object initList(HttpServletRequest request, HttpServletResponse response) {
		String currentPage = request.getParameter("page");
		String pageSize = request.getParameter("pagesize");
		String linkId = request.getParameter("linkId");

		Pager page = new Pager();
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setCurrentPage(Integer.valueOf(currentPage));
		}
		if (StringUtils.isNotEmpty(pageSize)) {
			page.setEveryPage(Integer.valueOf(pageSize));
		}

		PrjLnkCompApplyQueryCondition qc = new PrjLnkCompApplyQueryCondition();
		if (StringUtils.isNotEmpty(linkId)) {
			qc.setPrjLnkCompId(Long.valueOf(linkId));
		}
		page.setCondition(qc);
		Pager pager = this.prjLnkCompApplyService.searchListPage(page);
		List<PrjLnkCompApplyVO> list = (List<PrjLnkCompApplyVO>) pager.getResultList();
		ListPageVO<PrjLnkCompApplyVO> listPage = new ListPageVO<PrjLnkCompApplyVO>(list, pager.getTotalCount());
		BaseLogUtils.newWebLogger("初始化挂靠公司变更列表数据").setLogOperType(LogOperEnum.RESP)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_SQOT_MANAGER_CD)
				.setWarning(false)
				.setKeys("listPage", JSON.toJSONString(listPage))
				.info();
		return listPage;
	}

	/**
	 * 到挂靠公司流程变更记录页面
	 *
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/prjCompApplyProcessPage.do", method = { RequestMethod.GET })
	public ModelAndView prjCompApplyProcessPage(HttpServletRequest request, HttpServletResponse response) {
		ModelAndView view = new ModelAndView("project/prjLnkCompApply/prjlnkApplyProcessList");
		String linkId = request.getParameter("linkId"); // 挂靠公司ID
		view.addObject("linkId", linkId);
		BaseLogUtils.newWebLogger("跳转到变更记录页面").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_SQOT_MANAGER_CD)
				.setWarning(false)
				.setKeys("linkId", linkId)
				.info();
		return view;
	}

	/**
	 * 审批人流程审批页面 和呈报人驳回页面
	 *
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/modifyProcess.do", method = { RequestMethod.GET })
	public ModelAndView toProcessPage(HttpServletRequest request, HttpServletResponse response) {
		try {
			BaseLogUtils.newWebLogger("审批人流程审批页面").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SQOT_MANAGER_CD)
					.setWarning(false)
					.setKeys("request", super.getRequestParameter(request))
					.info();
			String lnkCompNm = request.getParameter("lnkCompNm");// 公司名称
			String orgCode = request.getParameter("orgCode");// 组织机构代码
			String bizLicNo = request.getParameter("bizLicNo");// 营业执照注册号
			String taxRegNo = request.getParameter("taxRegNo");// 税务登记号
			String audStsCd = request.getParameter("audStsCd");
			String isFlow = request.getParameter("isFlow");
			String BuOrgCd = CurrentThreadContext.getCurrentBuOrgCd();
			String applyId = request.getParameter("applyId");// 变更公司id
			String flag = request.getParameter("audStsCd"); // 前台标识
															// 0:呈报人页面，1：信审页面
			String succ = request.getParameter("succ"); //统一社会信用代码
			String isLegal = request.getParameter("isLegal");//是否是法务审核节点
			String isShowRate = request.getParameter("isShowRate");

			LnkCompModVO lnkCompModVO = this.lnkCompModService.selectById(Long.valueOf(applyId));

			if(lnkCompModVO == null){
				return this.oldToProcessPage(request);
			}

			Long id = lnkCompModVO.getLnkCompId();
			PrjLnkCompRlPsnQC pqc = new PrjLnkCompRlPsnQC();
			pqc.setPrjLnkCompId(id);
			ModelAndView view = null;
			List<PrjLnkCompRlPsnVO> prjLnkCompRlPsn = this.prjLnkCompRlPsnService.selectList(pqc);
			//整和两张表中的数据集合
			List<PrjLnkCompRlPsnVO> totalList = new ArrayList<>();
			// 封装联系人信息
			totalList = this.setRlPsnListInFlow(Long.valueOf(applyId), prjLnkCompRlPsn);

			String taskNm = request.getParameter("taskNm");
			if((StringUtils.isNotEmpty(taskNm) && "法务审核".equals(taskNm)) || BaseConstant.IS_YESNO_YES_STR.equals(isLegal)){
				view = new ModelAndView("project/prjLnkCompApply/prjlnkApplyProcesstoReport");
			}else{
				view = new ModelAndView("project/prjLnkCompApply/prjlnkApplyProcess");
			}

			// 挂靠公司关联人员类型
			List<KeyValueVO> prjLnkCompRlRsnTypList = prjLnkCompService.getPrjLnkCompRlRsnTypList();
			// 获取证件类型
			List<KeyValueVO> certTypCdList = prjLnkCompService.getCertTypCdList();
			view.addObject("certTypCdList", JSON.toJSONString(certTypCdList));
			view.addObject("rlRsnTypListJSON", JSON.toJSONString(prjLnkCompRlRsnTypList));

			//必填联系人类型
			List<SysDictionaryDTO> mustAddRlPsnTypCds = this.sysDictionaryApiService.searchGroupAll(CurrentThreadContext.getCurrentSysCd(),CurrentThreadContext.getCurrentOrgCd(),DictionaryConstant.CODE__PRJ_LNK_COMP_RL_PSN_TYP_CD);
			List<String> mustAddRlPsns = null ;
			List<String> noAddRlPsns = null ;
			if(CollectionUtils.isNotEmpty(mustAddRlPsnTypCds)){
				mustAddRlPsns = new ArrayList<>(mustAddRlPsnTypCds.size());
				noAddRlPsns = new ArrayList<>(mustAddRlPsnTypCds.size());
				for(SysDictionaryDTO dto : mustAddRlPsnTypCds){
					if(BaseConstant.IS_YESNO_YES == dto.getIsSysDef()){
						mustAddRlPsns.add(dto.getCode());
					}else if(2 == dto.getIsSysDef()){
					    noAddRlPsns.add(dto.getCode());
                    }
				}
			}
			view.addObject("mustAddRlPsnTypCdJSON", null == mustAddRlPsns ? null :JSON.toJSON(mustAddRlPsns));
			view.addObject("noAddRlPsnTypCdJSON", null == noAddRlPsns ? null :JSON.toJSON(noAddRlPsns));

			PrjLnkCompVO prjLnkCompVO = null;
			String defCodNm = "";
			for (KeyValueVO keyValueVO : certTypCdList) {
				if (keyValueVO.getKey().equals(PrjLnkCompRelInfoConstant.CODE_CERT_TYP_DEF_CD)) {
					defCodNm = keyValueVO.getValue();
				}
			}

			List<KeyValueVO> keyValueList = prjLnkCompService.getOwnerCdList();

			ListPageVO<PrjLnkCompRlPsnVO> prjLclistPage = new ListPageVO<PrjLnkCompRlPsnVO>(totalList, totalList.size());
			// id 存在时为修改
			if (StringUtils.isNotEmpty(id)) {
				prjLnkCompVO = this.prjLnkCompService.selectByIdInFlow(id,Long.valueOf(applyId));
				if(StringUtils.isNotEmpty(prjLnkCompVO.getRegDtStr())){
					prjLnkCompVO.setRegDt(DateUtils.formatStringToDate(prjLnkCompVO.getRegDtStr(), DateUtils.YYYY_MM_DD));
				}
				if(StringUtils.isNotEmpty(prjLnkCompVO.getSuppPrjTypCd())){
					List<String> suppPrjTypList = new ArrayList<>();
					String[] split = prjLnkCompVO.getSuppPrjTypCd().split(";");
					for (String string : split) {
						suppPrjTypList.add(string);
					}
					prjLnkCompVO.setSuppPrjTypCdList(suppPrjTypList);
					Map<String, String> suppPrjTypMap = this.sysDictionaryApiService.searchGroupToMap(SplSystemConstant.SPL_SYS_CD,
							SplSystemConstant.DEFAULT_ORG_CD, PrjLnkCompRelInfoConstant.SUPP_LNK_PRJ_TYP_DIC_CODE);
					StringBuffer sb = new StringBuffer();
					for (String string : suppPrjTypList) {
						sb.append(suppPrjTypMap.get(string));
						sb.append(",");
					}
					prjLnkCompVO.setSuppPrjTypCdNm(sb.substring(0,sb.length()-1).toString());
				}
				BaseLogUtils.newWebLogger("封装挂靠公司变更vo").setLogOperType(LogOperEnum.REQ)
						.setSysCd(CurrentThreadContext.getCurrentSysCd())
						.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
						.setBussinessId(BusinessIdConstant.LOG_SQOT_MANAGER_CD)
						.setWarning(false)
						.setKeys("prjLnkCompVO", JSON.toJSONString(prjLnkCompVO))
						.info();
				if(prjLnkCompVO.getExpDt() != null){
					prjLnkCompVO.setExpDtStr(DateUtils.formatDateToString(prjLnkCompVO.getExpDt(),DateUtils.YYYY_MM_DD));
				}
				if(prjLnkCompVO.getRegDt() != null){
					prjLnkCompVO.setRegDtStr(DateUtils.formatDateToString(prjLnkCompVO.getRegDt(),DateUtils.YYYY_MM_DD));
				}
				if(StringUtils.isNotEmpty(prjLnkCompVO.getIsRecycleLoa())){
					prjLnkCompVO.setIsRecycleLoaNm(prjLnkCompVO.getIsRecycleLoa() == 1 ? "是":"否");
				}
				if(StringUtils.isNotEmpty(prjLnkCompVO.getIsUploadLoa())){
					prjLnkCompVO.setIsUploadLoaNm(prjLnkCompVO.getIsUploadLoa() == 1 ? "是":"否");
				}
				SplCommPropInfoQC splCommPropQC = new SplCommPropInfoQC();
				splCommPropQC.setIsValid(BaseConstant.IS_YESNO_YES);
				splCommPropQC.setPropTypCd("002");
				splCommPropQC.setIsDel(BaseConstant.IS_YESNO_NO);
				splCommPropQC.setDataId(Long.valueOf(id));
				List<SplCommPropInfoDTO> commPropInfoDTOList = this.splCommPropInfoApiService.searchList(splCommPropQC);
				splCommPropQC.setIsValid(2);
				List<SplCommPropInfoDTO> commPropInfoDTOList2 = this.splCommPropInfoApiService.searchList(splCommPropQC);
				if(CollectionUtils.isNotEmpty(commPropInfoDTOList2)){
					commPropInfoDTOList = commPropInfoDTOList2;
				}
				if(CollectionUtils.isNotEmpty(commPropInfoDTOList)){
					String propinfo = "" ;
					for (SplCommPropInfoDTO commPropInfoDTO:commPropInfoDTOList) {
						propinfo +=commPropInfoDTO.getPropInfo();
						propinfo+=";";
					}
					prjLnkCompVO.setPropCd(propinfo.substring(0,propinfo.length()-1));
					SplCarsGuarDtlInfoQC carsGuarQC = new SplCarsGuarDtlInfoQC();
					carsGuarQC.setIsValid(BaseConstant.IS_YESNO_YES);
					carsGuarQC.setIsDel(BaseConstant.IS_YESNO_NO);
					carsGuarQC.setLnkId(Long.valueOf(id));
					List<SplCarsGuarDtlInfoDTO> carsGuarDTOList = this.splCarsGuarDtlInfoApiService.searchList(carsGuarQC);
					carsGuarQC.setIsValid(2);
					List<SplCarsGuarDtlInfoDTO> carsGuarDTOList2 = this.splCarsGuarDtlInfoApiService.searchList(carsGuarQC);

					if(CollectionUtils.isNotEmpty(carsGuarDTOList2)){
						carsGuarDTOList = carsGuarDTOList2;
					}
					if(CollectionUtils.isNotEmpty(carsGuarDTOList)){
						SplCarsGuarDtlInfoDTO carsGuarDtlInfoDTO = carsGuarDTOList.get(0);
						prjLnkCompVO.setValidTmStar(carsGuarDtlInfoDTO.getValidTmStar());
						prjLnkCompVO.setValidTmEnd(carsGuarDtlInfoDTO.getValidTmEnd());
						prjLnkCompVO.setStopTruckRate(carsGuarDtlInfoDTO.getStopTruckRate());
						prjLnkCompVO.setRoadBicycleRate(carsGuarDtlInfoDTO.getRoadBicycleRate());
					}
				}

			} else {
				prjLnkCompVO = new PrjLnkCompVO();
				prjLnkCompVO.setLnkCompNm(lnkCompNm);
				prjLnkCompVO.setOrgCode(orgCode);
				prjLnkCompVO.setBizLicNo(bizLicNo);
				prjLnkCompVO.setTaxRegNo(taxRegNo);
				prjLnkCompVO.setSucc(succ);
			}

			// 可支持挂靠项目类型所有集合--PRJ0148
			List<SysDictionaryDTO> prjTypCdList = this.sysDictionaryApiService.searchGroup(SplSystemConstant.SPL_SYS_CD,
					SplSystemConstant.DEFAULT_ORG_CD, PrjLnkCompRelInfoConstant.SUPP_LNK_PRJ_TYP_DIC_CODE);
			if (CollectionUtils.isNotEmpty(prjTypCdList)) {
				List<KeyValueVO> allSuppLnkPrjTypCdList = new ArrayList<>(prjTypCdList.size());
				KeyValueVO keyValueVO ;
				for (SysDictionaryDTO dto : prjTypCdList) {
					keyValueVO = new KeyValueVO();
					keyValueVO.setKey(dto.getCode());
					keyValueVO.setValue(dto.getCodeNm());
					allSuppLnkPrjTypCdList.add(keyValueVO);
				}
				view.addObject("suppLnkPrjTypCdListJson", JSONArray.fromObject(allSuppLnkPrjTypCdList.toArray()));
			}
			List<SysDictionaryDTO> propList = this.sysDictionaryApiService.searchGroup(SplSystemConstant.FL_SYS_CD,
					SplSystemConstant.DEFAULT_ORG_CD, "SPL0061");
			List<KeyValueVO> propKvList = new ArrayList<>();
			if(CollectionUtils.isNotEmpty(propList)){
				KeyValueVO keyValueVO ;
				for (SysDictionaryDTO dictionaryDTO:propList) {
					if(StringUtils.isNotEmpty(dictionaryDTO.getCodeAttr1()) && dictionaryDTO.getCodeAttr1().equals("LNK")) {
						keyValueVO = new KeyValueVO();
						keyValueVO.setKey(dictionaryDTO.getCode());
						keyValueVO.setValue(dictionaryDTO.getCodeNm());
						propKvList.add(keyValueVO);
					}
				}
			}

			view.addObject("propCdListJson", JSONArray.fromObject(propKvList.toArray()));


			if(StringUtils.isNotEmpty(taskNm) && "信审中心审核".equals(taskNm)){
				view.addObject("isCheckVerify", 1);
			}else{
				view.addObject("isCheckVerify", 0);
			}
			view.addObject("flag", flag);
			view.addObject("isShowRate", isShowRate);
			view.addObject("tabNm1", LnkCompFileCfgEnum.PRJ030.getTableNm());
			view.addObject("cfgCd1", LnkCompFileCfgEnum.PRJ030.getCode());
			view.addObject("cfgOrgCd1", LnkCompFileCfgEnum.PRJ030.getOrgCd());
			view.addObject("cfgSysCd1", LnkCompFileCfgEnum.PRJ030.getSysCd());
			view.addObject("modulePath1", LnkCompFileCfgEnum.PRJ030.getModulePath());
			view.addObject("costomerPath1", LnkCompFileCfgEnum.PRJ030.getUploadCostomerPath());
			view.addObject("rootPath1", LnkCompFileCfgEnum.PRJ030.getUploadRootPath());
			view.addObject("uploadSysCd1", LnkCompFileCfgEnum.PRJ030.getUploadSysCd());
			view.addObject("tabNm2", LnkCompFileCfgEnum.PRJ029.getTableNm());
			view.addObject("cfgCd2", LnkCompFileCfgEnum.PRJ029.getCode());
			view.addObject("cfgOrgCd2", LnkCompFileCfgEnum.PRJ029.getOrgCd());
			view.addObject("cfgSysCd2", LnkCompFileCfgEnum.PRJ029.getSysCd());
			view.addObject("modulePath2", LnkCompFileCfgEnum.PRJ029.getModulePath());
			view.addObject("costomerPath2", LnkCompFileCfgEnum.PRJ029.getUploadCostomerPath());
			view.addObject("rootPath2", LnkCompFileCfgEnum.PRJ029.getUploadRootPath());
			view.addObject("uploadSysCd2", LnkCompFileCfgEnum.PRJ029.getUploadSysCd());
			view.addObject("tabNm3", LnkCompFileCfgEnum.PRJ032.getTableNm());
			view.addObject("cfgCd3", LnkCompFileCfgEnum.PRJ032.getCode());
			view.addObject("cfgOrgCd3", LnkCompFileCfgEnum.PRJ032.getOrgCd());
			view.addObject("cfgSysCd3", LnkCompFileCfgEnum.PRJ032.getSysCd());
			view.addObject("modulePath3", LnkCompFileCfgEnum.PRJ032.getModulePath());
			view.addObject("costomerPath3", LnkCompFileCfgEnum.PRJ032.getUploadCostomerPath());
			view.addObject("rootPath3", LnkCompFileCfgEnum.PRJ032.getUploadRootPath());
			view.addObject("uploadSysCd3", LnkCompFileCfgEnum.PRJ032.getUploadSysCd());

			view.addObject("propTabNm", LnkCompFileCfgEnum.PRJ034.getTableNm());
			view.addObject("propCfgCd", LnkCompFileCfgEnum.PRJ034.getCode());
			view.addObject("propCfgOrgCd", LnkCompFileCfgEnum.PRJ034.getOrgCd());
			view.addObject("propCfgSysCd", LnkCompFileCfgEnum.PRJ034.getSysCd());
			view.addObject("propModulePath", LnkCompFileCfgEnum.PRJ034.getModulePath());
			view.addObject("propCostomerPath1", LnkCompFileCfgEnum.PRJ034.getUploadCostomerPath());
			view.addObject("propRootPath", LnkCompFileCfgEnum.PRJ034.getUploadRootPath());
			view.addObject("propUploadSysCd", LnkCompFileCfgEnum.PRJ034.getUploadSysCd());

            SysUlDatCfgQueryCondition ulDatCfgQueryCondition = new SysUlDatCfgQueryCondition();
            ulDatCfgQueryCondition.setSysCd(LnkCompFileCfgEnum.PRJ029.getSysCd());//系统代码
            ulDatCfgQueryCondition.setOrgCd(LnkCompFileCfgEnum.PRJ029.getOrgCd());
            ulDatCfgQueryCondition.setIsValid(BaseConstant.IS_YESNO_YES);
            ulDatCfgQueryCondition.setIsDel(BaseConstant.IS_YESNO_NO);
            List<String> cfgCdList = new ArrayList<>();
            cfgCdList.add(LnkCompFileCfgEnum.PRJ029.getCode());//配置编号
            cfgCdList.add(LnkCompFileCfgEnum.PRJ030.getCode());
            cfgCdList.add(LnkCompFileCfgEnum.PRJ032.getCode());
            ulDatCfgQueryCondition.setCfgCdList(cfgCdList);//配置编号集合
            List<SysUlDatCfgDTO> allCfgCdList = this.uploadApiService.searchSysUlDatCfgList(ulDatCfgQueryCondition);
            if (CollectionUtils.isNotEmpty(allCfgCdList)) {
                List<SysUlDatCfgDtlDTO> allCfgDtlCdList = new ArrayList<>();
                for (SysUlDatCfgDTO dto : allCfgCdList) {
                    allCfgDtlCdList.addAll(dto.getSysUlDatCfgDtlDTOList());
                }
                view.addObject("allCfgDtlCdList", JSON.toJSONString(allCfgDtlCdList));
            }

			view.addObject("rlPsnList", JSON.toJSONString(prjLclistPage));// 挂靠公司变更申请关联人员信息
			view.addObject("keyValueList", keyValueList);
			view.addObject("lnkCompId", id);
			view.addObject("BuOrgCd", BuOrgCd);
			view.addObject("prjLnkComp", prjLnkCompVO);
			//view.addObject("compApplyVO", compApplyVO); // 变更关联人员信息
			view.addObject("rlRsnTypList", JSON.toJSONString(prjLnkCompVO.getRlPsnList()));
			view.addObject("audStsCd", audStsCd);
			view.addObject("isFlow", isFlow);
			view.addObject("applyId", applyId);

			view.addObject("currentUserId", CurrentThreadContext.getCurrentUserId());
			BaseLogUtils.newWebLogger("跳转到修改挂靠公司页面").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SQOT_MANAGER_CD)
					.setWarning(false)
					.setKeys("id", id.toString())
					.info();
			return view;
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}

	/**
	 * 流程修改提交
	 */
	@RequestMapping(value = "/addPrjLnkCompApply.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object addPrjLnkCompApply(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_ADD_SUCC);
		PrjLnkCompVO prjLnkCompVO = null;
		String lnkCompId = request.getParameter("lnkCompId");// 挂靠公司id
		String compApplyId = request.getParameter("compApplyId"); // 挂靠公司变更id
		String rlapplylist = request.getParameter("rlapplylist"); // 接收关联人员信息
		List<PrjLcApplyRlPsnVO> list = new ArrayList<PrjLcApplyRlPsnVO>();
		String fileParams = request.getParameter("fileParams");
		Long id = null;

		try {
			prjLnkCompVO = getPrjLnkCompParam(request);
			if (StringUtils.isNotBlank(lnkCompId)) {
				// 修改关联人员变更信息
				list = JSON.parseArray(rlapplylist, PrjLcApplyRlPsnVO.class);
				this.prjLcApplyRlPsnService.modifyList(list);

				// 修改挂靠公司
				prjLnkCompVO.setId(Long.valueOf(lnkCompId));
				this.prjLnkCompService.modify(prjLnkCompVO);
				PrjLnkCompOrgRQC qc = new PrjLnkCompOrgRQC();
				qc.setLnkCompId(Long.valueOf(lnkCompId));
				qc.setBuOrgCd(CurrentThreadContext.getCurrentBuOrgCd());
				List<PrjLnkCompOrgRVO> rs = this.prjLnkCompOrgRService.searchList(qc);
				if (CollectionUtils.isEmpty(rs)) {
					PrjLnkCompOrgRVO prjLnkCompOrg = new PrjLnkCompOrgRVO();
					prjLnkCompOrg.setLnkCompId(Long.valueOf(lnkCompId));
					prjLnkCompOrg.setBuOrgCd(CurrentThreadContext.getCurrentBuOrgCd());
					this.prjLnkCompOrgRService.add(prjLnkCompOrg);
				}
				result.setSuccess(BaseConstant.IS_YESNO_YES);
				result.setInfo(SysLogConstant.LOG_CMM_UPDATE_SUCC);
			} else {
				// 获取页面参数
				prjLnkCompVO.setCrtTm(new Date());
				prjLnkCompVO.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
				prjLnkCompVO.setIsDel(BaseConstant.IS_YESNO_NO);
				prjLnkCompVO.setAudStsCd(PrjLnkCompRelInfoConstant.CODE_AUD_STS_NOT_AUDI_CD);// 获取默认的审核状态
				id = this.prjLnkCompService.add(prjLnkCompVO);
				PrjLnkCompOrgRQC qc = new PrjLnkCompOrgRQC();
				qc.setLnkCompId(id);
				qc.setBuOrgCd(CurrentThreadContext.getCurrentBuOrgCd());
				List<PrjLnkCompOrgRVO> rs = this.prjLnkCompOrgRService.searchList(qc);
				if (CollectionUtils.isEmpty(rs)) {
					PrjLnkCompOrgRVO prjLnkCompOrg = new PrjLnkCompOrgRVO();
					prjLnkCompOrg.setLnkCompId(id);
					prjLnkCompOrg.setBuOrgCd(CurrentThreadContext.getCurrentBuOrgCd());
					this.prjLnkCompOrgRService.add(prjLnkCompOrg);
				}

			}

			result.setData(id);
			BaseLogUtils.newWebLogger("新增挂靠公司变更数据").setLogOperType(LogOperEnum.RESP)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SQOT_MANAGER_CD)
					.setWarning(false)
					.setKeys("result", JSON.toJSONString(result))
					.info();
		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.newWebLogger("新增挂靠公司变更数据失败,业务异常").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SQOT_MANAGER_CD)
					.setWarning(false)
					.setThrowable(ex)
					.warn(LogExceptionEnum.COMMON_CODE_0001);
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.newWebLogger("新增挂靠公司变更数据失败,系统异常").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SQOT_MANAGER_CD)
					.setWarning(false)
					.setThrowable(ex)
					.error(LogExceptionEnum.COMMON_CODE_0099);
		}
		return result;
	}
	/**
	 * 变更前后对比详情页
	 */
	@RequestMapping(value = "/toComparePage.do", method = { RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toComparePage(HttpServletRequest request, HttpServletResponse response) {

		String id = request.getParameter("id");// 挂靠公司变更表id
		String lnkCompId = request.getParameter("prjLnkCompId");// 挂靠公司变更表id
		ModelAndView view = new ModelAndView("project/prjLnkCompApply/prjlnkApplyDetail");

		// 挂靠公司变更前后数据
		PrjLnkCompApplyVO compApply = this.prjLnkCompApplyService.selectById(Long.valueOf(id));
		if(compApply == null){
			JSONObject searchModDtlByModId = this.lnkCompModService.searchModDtlByModId(Long.valueOf(id), Long.valueOf(lnkCompId));
			view.addObject("changeObj",searchModDtlByModId);
		}else{
			PrjLnkCompVO vo = this.prjLnkCompService.selectById(Long.valueOf(lnkCompId));
			JSONObject obj = new JSONObject();
			obj.put("id", id);
			obj.put("prjLnkCompId", lnkCompId);
			obj.put("befLnkCompNm", compApply.getLnkCompNmB());
			obj.put("befRegDt", vo.getRegDt());
			obj.put("befRegAddr", vo.getRegAddr());
			obj.put("befCompTyp", vo.getCompTyp());
			obj.put("befBizScope", vo.getBizScope());
			obj.put("befSuppPrjTypCd", vo.getSuppPrjTypCd());
			obj.put("befSucc", compApply.getSuccB());

			obj.put("aftLnkCompNm", compApply.getLnkCompNm());
			obj.put("aftRegDt", vo.getRegDt());
			obj.put("aftRegAddr", vo.getRegAddr());
			obj.put("aftCompTyp", vo.getCompTyp());
			obj.put("aftBizScope", vo.getBizScope());
			obj.put("aftSuppPrjTypCd", vo.getSuppPrjTypCd());
			obj.put("aftSucc", compApply.getSucc());
			view.addObject("changeObj", obj);
		}
		view.addObject("lnkCompId",lnkCompId);
		//view.addObject("lnkCompId",lnkCompId);
		return view;
	}

	/**
	 * 挂靠公司变更申请关联人员信息
	 *
	 * @param request
	 * @param response
	 * @return
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/initCompApplyList.do", method = { RequestMethod.GET })
	@ResponseBody
	public Object initCompApplyList(HttpServletRequest request, HttpServletResponse response) {
		String id = request.getParameter("id");
		String lnkCompId = request.getParameter("lnkCompId");
		String type = request.getParameter("type");

		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,"查询成功");
		// 证件类型
		Map<String, String> certTypCdMap = this.sysDictionaryApiService.searchGroupToMap(CurrentThreadContext.getCurrentSysCd(),CurrentThreadContext.getCurrentOrgCd(),
				DictionaryConstant.CODE_GRP_CERT_TYP_CD);
		// 挂靠公司关联人员类型
		Map<String, String> lnkCompRlPsnTypCdMap = this.sysDictionaryApiService.searchGroupToMap(CurrentThreadContext.getCurrentSysCd(),CurrentThreadContext.getCurrentOrgCd(),
				DictionaryConstant.CODE__PRJ_LNK_COMP_RL_PSN_TYP_CD);
		LnkCompModDtlQC condition = new LnkCompModDtlQC();
		condition.setModId(Long.valueOf(id));
		condition.setIsDel(BaseConstant.IS_YESNO_NO);
		condition.setTabNm(LnkCompConstant.LNK_COMP_RL_PSN_FLOW_S_H_LNK_TAB);
		List<LnkCompModDtlDTO> lnkCompModDtlVOs = lnkCompModDtlService.searchList(condition );

		PrjLnkCompRlPsnQC qc = new PrjLnkCompRlPsnQC();
		qc.setPrjLnkCompId(Long.valueOf(lnkCompId));
		qc.setIsDel(BaseConstant.IS_YESNO_NO);
		qc.setIsValid(99);
		List<PrjLnkCompRlPsnVO> selectList = this.prjLnkCompRlPsnService.selectList(qc );

		List<PrjLnkCompRlPsnVO> befList = new ArrayList<>();
		List<PrjLnkCompRlPsnVO> aftList = new ArrayList<>();
		List<Long> addIds = new ArrayList<>();
		if(CollectionUtils.isNotEmpty(lnkCompModDtlVOs)){
			HashMap<Long, List<LnkCompModDtlDTO>> map = new HashMap<>();
			List<Long> ids = new ArrayList<>();
			for (LnkCompModDtlDTO lnkCompModDtlDTO : lnkCompModDtlVOs) {
				if(CommonOpTypCdEnum.MDF.getOpTypCd().equals(lnkCompModDtlDTO.getModTypCd())){
					// 联系人变更类型：修改
					if(map.containsKey(lnkCompModDtlDTO.getModBusId())){
						map.get(lnkCompModDtlDTO.getModBusId()).add(lnkCompModDtlDTO);
					}else{
						List<LnkCompModDtlDTO> modDtlDTOS = new ArrayList<>();
						modDtlDTOS.add(lnkCompModDtlDTO);
						map.put(lnkCompModDtlDTO.getModBusId(),modDtlDTOS);
					}
				}else if(CommonOpTypCdEnum.DEL.getOpTypCd().equals(lnkCompModDtlDTO.getModTypCd())){
					// 联系人变更类型：删除
					ids.add(lnkCompModDtlDTO.getModBusId());
				}else if(CommonOpTypCdEnum.ADD.getOpTypCd().equals(lnkCompModDtlDTO.getModTypCd())){
					addIds.add(lnkCompModDtlDTO.getModBusId());
				}

			}
			if(CollectionUtils.isNotEmpty(selectList)){
				for (PrjLnkCompRlPsnVO vo : selectList) {
					vo.setRlTypCdNm(lnkCompRlPsnTypCdMap.get(vo.getRlTypCd()));
					vo.setCertTypCdNm(certTypCdMap.get(vo.getCertTypCd()));
				}
				for (PrjLnkCompRlPsnVO prjLnkCompRlPsnVO : selectList) {
					if(StringUtils.isNotEmpty(prjLnkCompRlPsnVO.getIsValid()) && prjLnkCompRlPsnVO.getIsValid() == 2){
						aftList.add(prjLnkCompRlPsnVO);
					}
					if(CollectionUtils.isNotEmpty(lnkCompModDtlVOs)){
						List<LnkCompModDtlDTO> dtlDTOS = map.get(prjLnkCompRlPsnVO.getId());
						if(CollectionUtils.isNotEmpty(dtlDTOS)){
							if("aft".equals(type)){
								for (LnkCompModDtlDTO modDtlDTO:dtlDTOS) {
									Field field = null;
									try {
										// 获取field
										field = BasePrjLnkCompRlPsnVO.class.getDeclaredField(modDtlDTO.getModAttrFiled());
									} catch (NoSuchFieldException e) {
										e.printStackTrace();
									}
									field.setAccessible(true);
									try {
										// 封装lnkCompRlPsnVO
										field.set((Object) prjLnkCompRlPsnVO, modDtlDTO.getModConAft());
									} catch (IllegalAccessException e) {
										e.printStackTrace();
									}
								}
								aftList.add(prjLnkCompRlPsnVO);
							}else{
								for (LnkCompModDtlDTO modDtlDTO:dtlDTOS) {
									Field field = null;
									try {
										// 获取field
										field = BasePrjLnkCompRlPsnVO.class.getDeclaredField(modDtlDTO.getModAttrFiled());
									} catch (NoSuchFieldException e) {
										e.printStackTrace();
									}
									field.setAccessible(true);
									try {
										// 封装lnkCompRlPsnVO
										field.set((Object) prjLnkCompRlPsnVO, modDtlDTO.getModConBef());
									} catch (IllegalAccessException e) {
										e.printStackTrace();
									}
								}
								befList.add(prjLnkCompRlPsnVO);
							}
						}
					}
				}
			}
		}
		Map<Long, PrjLnkCompRlPsnVO> befMap = new HashMap<>();
		Map<Long, PrjLnkCompRlPsnVO> aftMap = new HashMap<>();
		if(CollectionUtils.isNotEmpty(befList)){
			for (PrjLnkCompRlPsnVO vo : befList) {
				befMap.put(vo.getId(), vo);
				vo.setRlTypCdNm(lnkCompRlPsnTypCdMap.get(vo.getRlTypCd()));
				vo.setCertTypCdNm(certTypCdMap.get(vo.getCertTypCd()));
			}
			for(int i = 0 ; i<befList.size();i++){
				if(addIds.contains(befList.get(i).getId())){
					befList.remove(i);
				}
			}
		}
		if(CollectionUtils.isNotEmpty(aftList)){
			for (PrjLnkCompRlPsnVO vo : aftList) {
				aftMap.put(vo.getId(), vo);
				vo.setRlTypCdNm(lnkCompRlPsnTypCdMap.get(vo.getRlTypCd()));
				vo.setCertTypCdNm(certTypCdMap.get(vo.getCertTypCd()));
			}
		}
		if(CollectionUtils.isEmpty(aftList) && CollectionUtils.isEmpty(befList)
				&& CollectionUtils.isNotEmpty(selectList)){
			result.setData(selectList);
		}else if("bef".equals(type)){
			for (PrjLnkCompRlPsnVO vo : selectList) {
				if((!befMap.containsKey(vo.getId())) && (!addIds.contains(vo.getId()))){
					befList.add(vo);
				}
			}
			result.setData(befList);
		}else{
			for (PrjLnkCompRlPsnVO vo : selectList) {
				if(!aftMap.containsKey(vo.getId())){
					aftList.add(vo);
				}
			}
			result.setData(aftList);
		}
		BaseLogUtils.newWebLogger("挂靠公司变更申请关联人员信息").setLogOperType(LogOperEnum.RESP)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_SQOT_MANAGER_CD)
				.setWarning(false)
				.setKeys("result", JSON.toJSONString(result))
				.info();
		return result;
	}

	/**
	 * 挂靠公司名称、营业执照、组织机构代码证、税务登记证、道路运输许可证有效期、主要联系人、
	 * 实际经营者、股东、法人代表(姓名、联系电话、证件号)变更需经变更流程；其他信息修改无需经变更流程。
	 *
	 * 流程更改字段保存
	 */
	@RequestMapping(value = "/addPrjLnkComp.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object add(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_ADD_SUCC);
		PrjLnkCompVO prjLnkCompVO = null; // 挂靠公司
		String applyId = request.getParameter("applyId"); // 挂靠公司变更id
		String lnkCompId = request.getParameter("lnkCompId");// 挂靠公司ID
		String fileParams = request.getParameter("fileParams");
		String oldOwnerCd = request.getParameter("oldOwner");
		String propCd = request.getParameter("propCd");
		String validTmStar = request.getParameter("validTmStar");
		String validTmEnd = request.getParameter("validTmEnd");
		String roadBicycleRate = request.getParameter("roadBicycleRate");
		String stopTruckRate = request.getParameter("stopTruckRate");
		String propFileParams = request.getParameter("propFileParams");
		String ownerCd = request.getParameter("ownerCd");

		//发起变更的附件配置信息
		List<String> cfgDtlCdList = new ArrayList<>();
		cfgDtlCdList.add("10");
		cfgDtlCdList.add("20");
		cfgDtlCdList.add("30");
		cfgDtlCdList.add("50");
		cfgDtlCdList.add("80");
		try {
			boolean isFileApply = false ;

			this.prjLnkCompService.checkLnkFiles(request);
			prjLnkCompVO = getPrjLnkCompParam(request); // 获取页面参数
			prjLnkCompVO.setId(Long.valueOf(lnkCompId));
			// 挂靠公司原数据
			PrjLnkCompVO prjLnkComp = this.prjLnkCompService.selectById(Long.valueOf(lnkCompId));
			if((!prjLnkCompVO.getLnkCompNm().equals(prjLnkComp.getLnkCompNm()) )
					&& (!prjLnkCompVO.getSucc().equals(prjLnkComp.getSucc()))){
				result.setInfo("挂靠公司名称及社会统一信用代码不可同时修改！");
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				return result ;
			}
			// 关联人员原数据
			PrjLnkCompRlPsnQC rlqc = new PrjLnkCompRlPsnQC();
			rlqc.setPrjLnkCompId(Long.valueOf(lnkCompId));
			//by lgj 20180319
			//rlqc.setIsDefault(1);
			List<PrjLnkCompRlPsnVO> preList = this.prjLnkCompRlPsnService.selectList(rlqc);
			// 关联人员变更数据
			String list = request.getParameter("rlPsnList");
			List<PrjLnkCompRlPsnVO> bakList = JSON.parseArray(list, PrjLnkCompRlPsnVO.class);

			PrjLnkCompDTO dto = PrjLnkCompVOTransform.toDTO(prjLnkCompVO);
			String removeFileIds = request.getParameter("removeFileIds");
			if(StringUtils.isNotEmpty(removeFileIds)){
				List<String> removeFileIdList = new ArrayList<>();
				isFileApply = true;
				String[] split = removeFileIds.split(",");
				for (String string : split) {
					removeFileIdList.add(string);
				}
				dto.setRemoveFileIdList(removeFileIdList);
			}

			dto.setSuppPrjTypCdList(null);
			dto.setRlPsnList(PrjLnkCompRlPsnVOTransform.toDTOList(bakList));

			// 挂靠公司变更id如有修改否则添加
			if (StringUtils.isEmpty(applyId)) {
				if(this.prjLnkCompService.checkLnkCompFLowStatus(Long.valueOf(lnkCompId),false)){
					throw new BaseException(BaseExceptionConstant.COMMON_0002, "该挂靠公司存在变更流程，请变更流程结束后再发起审核流程.");
				}
				if(this.prjLnkCompApplyService.checkFlowStatus(Long.valueOf(lnkCompId), CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd())){
					throw new BaseException(BaseExceptionConstant.COMMON_0002, "该挂靠公司存在变更流程，请变更流程结束后再发起审核流程.");
				}
				LnkCompModDTO lnkCompModDTO = new LnkCompModDTO();
				lnkCompModDTO.setIsBscMdf(BaseConstant.IS_YESNO_YES);
				lnkCompModDTO.setIsRlPsnMdf(BaseConstant.IS_YESNO_NO);
				lnkCompModDTO.setAudStsCd(FlowConstant.FLOW_CHECK_STATE_IN);
				lnkCompModDTO.setCrtTm(new Date());
				lnkCompModDTO.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
				lnkCompModDTO.setCrtUsrName(CurrentThreadContext.getCurrentUserName());
				lnkCompModDTO.setIsDel(BaseConstant.IS_YESNO_NO);
				lnkCompModDTO.setIsNew(BaseConstant.IS_YESNO_YES);
				lnkCompModDTO.setIsValid(BaseConstant.IS_YESNO_YES);
				lnkCompModDTO.setLnkCompId(Long.valueOf(lnkCompId));
				lnkCompModDTO.setTabNm(LnkCompConstant.LNK_COMP_FLOW_S_H_LNK_TAB);
				//是否附件信息变更
				JSONArray flieArry = null ;
				flieArry = JSONArray.fromObject(fileParams);
				if(StringUtils.isNotEmpty(fileParams)){
					List<PrjFileInfoVO> fileParamList = JSON.parseArray(fileParams, PrjFileInfoVO.class);
					for (PrjFileInfoVO prjFileInfoVO : fileParamList) {
						if(StringUtils.isEmpty(prjFileInfoVO.getFileId()) && cfgDtlCdList.contains(prjFileInfoVO.getCfgDtlCd())){
							isFileApply = true;
							lnkCompModDTO.setIsFileMdf(BaseConstant.IS_YESNO_YES);
							break ;
						}else if(StringUtils.isEmpty(prjFileInfoVO.getFileId())){
							isFileApply = true;
						}
					}
				}
				Long modId = lnkCompModService.addLnkCompMod(lnkCompModDTO,dto , CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd());
				if(StringUtils.isEmpty(modId)){
					result.setSuccess(BaseConstant.IS_YESNO_NO);
					result.setInfo(SysLogConstant.LOG_CMM_UPDATE_FAIL);
					BaseLogUtils.newWebLogger("修改挂靠公司信息失败!").setLogOperType(LogOperEnum.RESP)
							.setSysCd(CurrentThreadContext.getCurrentSysCd())
							.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
							.setBussinessId(BusinessIdConstant.LOG_SQOT_MANAGER_CD)
							.setWarning(false)
							.setKeys("lnkCompModDTO", JSONObject.toJSONString(lnkCompModDTO))
							.warn(LogExceptionEnum.COMMON_CODE_0002);
					return result;
				}else if(modId == 0){
					result.setInfo("基础信息保存成功！");
					return result ;
				}
				//附件信息变更
				if(isFileApply){
					//COPY 旧附件信息
					List<SysUlFilesRecVO> oldUlFilesRecVOList = null;
					SysUlFilesRecQueryCondition filesRecQueryCondition = new SysUlFilesRecQueryCondition();
					filesRecQueryCondition.setSysCd(SplSystemConstant.SPL_SYS_CD);
					filesRecQueryCondition.setIsDel(0);
					filesRecQueryCondition.setPkId(String.valueOf(lnkCompId));
					List<SysUlFilesRecVO> sysUlFilesRecVOs = this.sysUlFilesRecService.searchList(filesRecQueryCondition);
					if (CollectionUtils.isNotEmpty(sysUlFilesRecVOs)) {
						oldUlFilesRecVOList = new ArrayList<>(sysUlFilesRecVOs.size());
						SysUlFilesRecVO vo = null;
						for (SysUlFilesRecVO sysUlFilesRecVO : sysUlFilesRecVOs) {
							vo = sysUlFilesRecVO;
							vo.setId(null);
							vo.setPkId(String.valueOf(modId));
							oldUlFilesRecVOList.add(vo);
						}
					}
					BaseLogUtils.newWebLogger("获取挂靠公司附件信息变更详情").setLogOperType(LogOperEnum.RESP)
							.setSysCd(CurrentThreadContext.getCurrentSysCd())
							.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
							.setBussinessId(BusinessIdConstant.LOG_SQOT_MANAGER_CD)
							.setWarning(false)
							.setKeys("oldUlFilesRecVOList", JSON.toJSONString(oldUlFilesRecVOList))
							.info();

					List<SysUlFilesRecVO> newUlFilesRecVOList = null ;
					try {
						newUlFilesRecVOList = this.getFileList(fileParams, modId,prjLnkComp);
						if (CollectionUtils.isNotEmpty(newUlFilesRecVOList)) {
							for (SysUlFilesRecVO sysUlFilesRecVO : newUlFilesRecVOList) {
								sysUlFilesRecVO.setCrtTm(new Date());
								sysUlFilesRecVO.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
							}
							boolean success = this.sysUlFilesRecService.addSysUlFilesResList(newUlFilesRecVOList);
							if (!success) {
								BaseLogUtils.newWebLogger("新增挂靠变更流程资料失败!").setLogOperType(LogOperEnum.RESP)
										.setSysCd(CurrentThreadContext.getCurrentSysCd())
										.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
										.setBussinessId(BusinessIdConstant.LOG_SQOT_MANAGER_CD)
										.setWarning(false)
										.warn(LogExceptionEnum.COMMON_CODE_0002);
							} else {
							    this.lnkCompModService.modifyLnkCompModDtlFileList(Long.valueOf(lnkCompId),modId);
								BaseLogUtils.newWebLogger("新增挂靠变更流程资料成功").setLogOperType(LogOperEnum.RESP)
										.setSysCd(CurrentThreadContext.getCurrentSysCd())
										.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
										.setBussinessId(BusinessIdConstant.LOG_SQOT_MANAGER_CD)
										.setWarning(false)
										.setKeys("newUlFilesRecVOList", JSON.toJSONString(newUlFilesRecVOList))
										.info();
							}
						}
						List<SplCommPropInfoVO> splCommPropInfoVOS = null ;
						if(StringUtils.isNotEmpty(propCd)){
							if(StringUtils.isEmpty(validTmStar)){
								throw new BaseException(BaseExceptionConstant.COMMON_0001, "请填写协议担保有效期！");
							}
							if(StringUtils.isEmpty(validTmEnd)){
								throw new BaseException(BaseExceptionConstant.COMMON_0001, "请填写协议担保有效期！");
							}
							splCommPropInfoVOS = new ArrayList<>();
							String[] propArray = propCd.split(";");
							SplCommPropInfoVO propVO ;
							for (String prop:propArray) {
								propVO = new SplCommPropInfoVO();
								propVO.setDataId(Long.valueOf(lnkCompId));
								propVO.setPropInfo(prop);
								propVO.setPropTypCd("002");
								propVO.setIsDel(BaseConstant.IS_YESNO_NO);
								propVO.setIsValid(2);
								propVO.setCrtTm(new Date());
								propVO.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
								splCommPropInfoVOS.add(propVO);
							}
							SplCarsGuarDtlInfoDTO carsGuarDtlInfoDTO = new SplCarsGuarDtlInfoDTO();
							carsGuarDtlInfoDTO.setValidTmStar(DateUtils.formatStringToDate(validTmStar,DateUtils.YYYY_MM_DD));
							carsGuarDtlInfoDTO.setValidTmEnd(DateUtils.formatStringToDate(validTmEnd,DateUtils.YYYY_MM_DD));
							carsGuarDtlInfoDTO.setCrtTm(new Date());
							carsGuarDtlInfoDTO.setIsDel(BaseConstant.IS_YESNO_NO);
							carsGuarDtlInfoDTO.setIsValid(2);
							carsGuarDtlInfoDTO.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
							carsGuarDtlInfoDTO.setLnkId(Long.valueOf(lnkCompId));
							this.splCarsGuarDtlInfoApiService.add(carsGuarDtlInfoDTO);

							if (StringUtils.isNotBlank(propFileParams)) {
								List<PrjFileInfoVO> fileParamList = JSON.parseArray(propFileParams, PrjFileInfoVO.class);
								if(CollectionUtils.isNotEmpty(fileParamList)){
									BaseLogUtils.newLogger("附件信息").setKeys("fileParamList.size()",fileParamList.size()+"").info();
									List<SysUlFilesRecDTO> addFileList = new ArrayList<>();
									List<SysUlFilesRecDTO> modifyFileList = new ArrayList<>();

									SysUlFilesRecDTO filesRecDTO ;
									List<String> cfgDtlList = new ArrayList<>();
									for (PrjFileInfoVO fileInfoVO : fileParamList) {
										cfgDtlList.add(fileInfoVO.getCfgDtlCd());
									}
									for (PrjFileInfoVO fileInfoVO : fileParamList) {
										filesRecDTO = new SysUlFilesRecDTO();
										filesRecDTO.setFilePath(fileInfoVO.getFilePath());
										filesRecDTO.setFileNm(fileInfoVO.getFileNm());
										filesRecDTO.setCfgCd(SplInfoFileCfgEnum.PRJ034.getCode());
										filesRecDTO.setTabNm(SplInfoFileCfgEnum.PRJ034.getTableNm());
										filesRecDTO.setSysCd(SplInfoFileCfgEnum.PRJ034.getSysCd());
										filesRecDTO.setCfgDtlCd(fileInfoVO.getCfgDtlCd());
										filesRecDTO.setOrgCd(fileInfoVO.getOrgCd());
										filesRecDTO.setAbsLocPath(PropertiesCacheUtils.getProperty(SplInfoFileCfgEnum.PRJ034.getUploadRootPath())+filesRecDTO.getFilePath());
										filesRecDTO.setCrtTm(new Date());
										filesRecDTO.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
										filesRecDTO.setIsDel(BaseConstant.IS_YESNO_NO);
										//默认验证状态:未验证
										filesRecDTO.setAudStsCd(PropertiesCacheUtils.getProperty(fl.constant.facade.framework.constant.DictionaryConstant.CODE_GRP_VALID_STATUS_CD_A));
										if (StringUtils.isNotEmpty(fileInfoVO.getFileId())) {
											filesRecDTO.setPkId(lnkCompId);
											filesRecDTO.setId(fileInfoVO.getFileId());
											modifyFileList.add(filesRecDTO);
										}else{
											filesRecDTO.setPkId(modId+"");
											addFileList.add(filesRecDTO);
										}
									}
									if(CollectionUtils.isNotEmpty(addFileList)){
										this.uploadApiService.addSysUlFilesRecList(addFileList);
									}
									if(CollectionUtils.isNotEmpty(modifyFileList)){
										this.uploadApiService.modifySysUlFilesRecList(modifyFileList);
									}
								}else{
									throw new BaseException(BaseExceptionConstant.COMMON_0001, "请上传附件信息！");
								}
							}else{
								throw new BaseException(BaseExceptionConstant.COMMON_0001, "请上传附件信息！");
							}
						}
						if(CollectionUtils.isNotEmpty(splCommPropInfoVOS)){
							splCommPropInfoApiService.batchAdd(SplCommPropInfoVOTransform.toDTOList(splCommPropInfoVOS));
						}
					} catch (BaseException ex) {
						BaseLogUtils.newWebLogger("新增挂靠变更流程资料失败,业务异常").setLogOperType(LogOperEnum.REQ)
								.setSysCd(CurrentThreadContext.getCurrentSysCd())
								.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
								.setBussinessId(BusinessIdConstant.LOG_SQOT_MANAGER_CD)
								.setWarning(false)
								.setThrowable(ex)
								.warn(LogExceptionEnum.COMMON_CODE_0001);
					} catch (Exception ex) {
						BaseLogUtils.newWebLogger("新增挂靠变更流程资料失败,系统异常").setLogOperType(LogOperEnum.REQ)
								.setSysCd(CurrentThreadContext.getCurrentSysCd())
								.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
								.setBussinessId(BusinessIdConstant.LOG_SQOT_MANAGER_CD)
								.setWarning(false)
								.setThrowable(ex)
								.error(LogExceptionEnum.COMMON_CODE_0099);
					}
				}
				if (StringUtils.isNotEmpty(modId)) {
					// 启动审批流程
					boolean checkBlack = prjLnkCompQueryApiService.checkLnkCompIsBlack(Long.valueOf(lnkCompId),CurrentThreadContext.getCurrentSysCd(),CurrentThreadContext.getCurrentOrgCd());
					if(checkBlack){
						result.setSuccess(BaseConstant.IS_YESNO_NO);
						result.setInfo("当前挂靠公司已存在黑名单，无法发起变更流程");
						return result ;
					}
					FlowStartedDTO flowStartedDTO =addFlowStart(request, Long.valueOf(modId));
					if(StringUtils.isNotBlank(flowStartedDTO.getNextOperUsrNames())){
						result.setInfo("下一个节点操作人:"+flowStartedDTO.getNextOperUsrNames());
					}else{
						result.setInfo("流程发起成功");
					}
				}
				/*--------------------------------------驳回修改--------------------------------------------*/
			} else {
				List<SplCommPropInfoVO> splCommPropInfoVOS = null ;
				if(StringUtils.isNotEmpty(propCd)){
					if(StringUtils.isEmpty(validTmStar)){
						throw new BaseException(BaseExceptionConstant.COMMON_0001, "请填写协议担保有效期！");
					}
					if(StringUtils.isEmpty(validTmEnd)){
						throw new BaseException(BaseExceptionConstant.COMMON_0001, "请填写协议担保有效期！");
					}
					splCommPropInfoVOS = new ArrayList<>();
					String[] propArray = propCd.split(";");
					SplCommPropInfoVO propVO ;
					for (String prop:propArray) {
						propVO = new SplCommPropInfoVO();
						propVO.setDataId(Long.valueOf(lnkCompId));
						propVO.setPropInfo(prop);
						propVO.setPropTypCd("002");
						propVO.setIsDel(BaseConstant.IS_YESNO_NO);
						propVO.setIsValid(2);
						propVO.setCrtTm(new Date());
						propVO.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
						splCommPropInfoVOS.add(propVO);
					}

					SplCarsGuarDtlInfoDTO carsGuarDtlInfoDTO = null ;
					SplCarsGuarDtlInfoQC qc = new SplCarsGuarDtlInfoQC();
					qc.setIsValid(2);
					qc.setLnkId(Long.valueOf(lnkCompId));
					qc.setIsDel(BaseConstant.IS_YESNO_NO);
					List<SplCarsGuarDtlInfoDTO> dtlInfoDTOS = this.splCarsGuarDtlInfoApiService.searchList(qc);
					if(CollectionUtils.isNotEmpty(dtlInfoDTOS)){
						carsGuarDtlInfoDTO = dtlInfoDTOS.get(0);
						carsGuarDtlInfoDTO.setValidTmStar(DateUtils.formatStringToDate(validTmStar,DateUtils.YYYY_MM_DD));
						carsGuarDtlInfoDTO.setValidTmEnd(DateUtils.formatStringToDate(validTmEnd,DateUtils.YYYY_MM_DD));
						DecimalFormat df = new DecimalFormat("#.00");
						if(StringUtils.isNotEmpty(roadBicycleRate)) {
							carsGuarDtlInfoDTO.setRoadBicycleRate(Double.valueOf(df.format(Double.valueOf(roadBicycleRate))));
						}
						if(StringUtils.isNotEmpty(stopTruckRate)) {
							carsGuarDtlInfoDTO.setStopTruckRate(Double.valueOf(df.format(Double.valueOf(stopTruckRate))));
						}
						carsGuarDtlInfoDTO.setMdfTm(new Date());
						carsGuarDtlInfoDTO.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
						this.splCarsGuarDtlInfoApiService.modify(carsGuarDtlInfoDTO);
					}else{
						carsGuarDtlInfoDTO = new SplCarsGuarDtlInfoDTO();
						carsGuarDtlInfoDTO.setValidTmStar(DateUtils.formatStringToDate(validTmStar,DateUtils.YYYY_MM_DD));
						carsGuarDtlInfoDTO.setValidTmEnd(DateUtils.formatStringToDate(validTmEnd,DateUtils.YYYY_MM_DD));
						DecimalFormat df = new DecimalFormat("#.00");
						if(StringUtils.isNotEmpty(roadBicycleRate)) {
							carsGuarDtlInfoDTO.setRoadBicycleRate(Double.valueOf(df.format(Double.valueOf(roadBicycleRate))));
						}else{
							carsGuarDtlInfoDTO.setRoadBicycleRate(5.00D);
						}
						if(StringUtils.isNotEmpty(stopTruckRate)) {
							carsGuarDtlInfoDTO.setStopTruckRate(Double.valueOf(df.format(Double.valueOf(stopTruckRate))));
						}else{
							carsGuarDtlInfoDTO.setStopTruckRate(5.00D);
						}
						carsGuarDtlInfoDTO.setIsValid(2);
						carsGuarDtlInfoDTO.setIsDel(BaseConstant.IS_YESNO_NO);
						carsGuarDtlInfoDTO.setCrtTm(new Date());
						carsGuarDtlInfoDTO.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
						carsGuarDtlInfoDTO.setLnkId(Long.valueOf(lnkCompId));
						this.splCarsGuarDtlInfoApiService.add(carsGuarDtlInfoDTO);
					}

					if (StringUtils.isNotBlank(propFileParams)) {
						List<PrjFileInfoVO> fileParamList = JSON.parseArray(propFileParams, PrjFileInfoVO.class);
						if(CollectionUtils.isNotEmpty(fileParamList)){
							BaseLogUtils.newLogger("附件信息").setKeys("fileParamList.size()",fileParamList.size()+"").info();
							List<SysUlFilesRecDTO> addFileList = new ArrayList<>();
							List<SysUlFilesRecDTO> modifyFileList = new ArrayList<>();

							SysUlFilesRecDTO filesRecDTO ;
							List<String> cfgDtlList = new ArrayList<>();
							for (PrjFileInfoVO fileInfoVO : fileParamList) {
								cfgDtlList.add(fileInfoVO.getCfgDtlCd());
							}
							for (PrjFileInfoVO fileInfoVO : fileParamList) {
								filesRecDTO = new SysUlFilesRecDTO();
								filesRecDTO.setFilePath(fileInfoVO.getFilePath());
								filesRecDTO.setFileNm(fileInfoVO.getFileNm());
								filesRecDTO.setCfgCd(SplInfoFileCfgEnum.PRJ034.getCode());
								filesRecDTO.setTabNm(SplInfoFileCfgEnum.PRJ034.getTableNm());
								filesRecDTO.setSysCd(SplInfoFileCfgEnum.PRJ034.getSysCd());
								filesRecDTO.setCfgDtlCd(fileInfoVO.getCfgDtlCd());
								filesRecDTO.setOrgCd(fileInfoVO.getOrgCd());
								filesRecDTO.setAbsLocPath(PropertiesCacheUtils.getProperty(SplInfoFileCfgEnum.PRJ034.getUploadRootPath())+filesRecDTO.getFilePath());
								filesRecDTO.setCrtTm(new Date());
								filesRecDTO.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
								filesRecDTO.setIsDel(BaseConstant.IS_YESNO_NO);
								//默认验证状态:未验证
								filesRecDTO.setAudStsCd(PropertiesCacheUtils.getProperty(fl.constant.facade.framework.constant.DictionaryConstant.CODE_GRP_VALID_STATUS_CD_A));
								if (StringUtils.isNotEmpty(fileInfoVO.getFileId())) {

								}else{
									filesRecDTO.setPkId(applyId+"");
									addFileList.add(filesRecDTO);
								}
							}
							if(CollectionUtils.isNotEmpty(addFileList)){
								this.uploadApiService.addSysUlFilesRecList(addFileList);
							}
							if(CollectionUtils.isNotEmpty(modifyFileList)){
								this.uploadApiService.modifySysUlFilesRecList(modifyFileList);
							}
						}else{
							throw new BaseException(BaseExceptionConstant.COMMON_0001, "请上传附件信息！");
						}
					}else{
						throw new BaseException(BaseExceptionConstant.COMMON_0001, "请上传附件信息！");
					}
				}
				if(CollectionUtils.isNotEmpty(splCommPropInfoVOS)){
					splCommPropInfoApiService.batchAdd(SplCommPropInfoVOTransform.toDTOList(splCommPropInfoVOS));
				}
				if(StringUtils.isNotEmpty(oldOwnerCd) && !oldOwnerCd.equals(prjLnkCompVO.getOwnerCd())){
					String cfgCd = null ;
					if ("1".equals(prjLnkCompVO.getOwnerCd())) {
                		cfgCd = LnkCompFileCfgEnum.PRJ030.getCode();
                	}else if("2".equals(prjLnkCompVO.getOwnerCd())){
                		cfgCd = LnkCompFileCfgEnum.PRJ029.getCode();
                	}else{
                		cfgCd = LnkCompFileCfgEnum.PRJ032.getCode();
                	}
					SysUlFilesRecQueryCondition queryCondition = new SysUlFilesRecQueryCondition();
		            queryCondition.setPkId(applyId);
		            queryCondition.setIsDel(BaseConstant.IS_YESNO_NO);
		            queryCondition.setSysCd(SplSystemConstant.SPL_SYS_CD);
		            queryCondition.setTabNm(LnkCompConstant.LNK_COMP_MOD_FLOW_S_H_LNK_TAB);
		            List<SysUlFilesRecDTO> sysUlFilesRecDTOs = this.uploadApiService.searchSysUlFilesRecNoUrlPrefixList(queryCondition);
		            if(CollectionUtils.isNotEmpty(sysUlFilesRecDTOs)){
		            	for (SysUlFilesRecDTO sysUlFilesRecDTO : sysUlFilesRecDTOs) {
		            		sysUlFilesRecDTO.setCfgCd(cfgCd);
		            		sysUlFilesRecDTO.setMdfTm(new Date());
		            		sysUlFilesRecDTO.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
						}
		            	this.uploadApiService.modifySysUlFilesRecList(sysUlFilesRecDTOs);
		            }
				}
				LnkCompModVO compModVO = this.lnkCompModService.selectById(Long.valueOf(applyId));
				if(compModVO == null){
					return this.oldAdd(request);
				}
				if(StringUtils.isNotEmpty(fileParams)){
					JSONArray arry = JSONArray.fromObject(fileParams);
					List<SysUlFilesRecVO> newUlFilesRecVOList = null;
					try {
						newUlFilesRecVOList = this.getFileList(fileParams, Long.valueOf(applyId),prjLnkComp);
						if (CollectionUtils.isNotEmpty(newUlFilesRecVOList)) {
							for (SysUlFilesRecVO sysUlFilesRecVO : newUlFilesRecVOList) {
								sysUlFilesRecVO.setId(null);
								sysUlFilesRecVO.setMdfTm(new Date());
								sysUlFilesRecVO.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
							}
							boolean success = this.sysUlFilesRecService.addSysUlFilesResList(newUlFilesRecVOList);
							if (!success) {
								BaseLogUtils.newWebLogger("新增挂靠变更流程资料失败!").setLogOperType(LogOperEnum.RESP)
										.setSysCd(CurrentThreadContext.getCurrentSysCd())
										.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
										.setBussinessId(BusinessIdConstant.LOG_SQOT_MANAGER_CD)
										.setWarning(false)
										.warn(LogExceptionEnum.COMMON_CODE_0002);
							} else {
	                            this.lnkCompModService.modifyLnkCompModDtlFileList(Long.valueOf(lnkCompId),Long.valueOf(applyId));
								BaseLogUtils.newWebLogger("新增挂靠变更流程资料成功").setLogOperType(LogOperEnum.RESP)
										.setSysCd(CurrentThreadContext.getCurrentSysCd())
										.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
										.setBussinessId(BusinessIdConstant.LOG_SQOT_MANAGER_CD)
										.setWarning(false)
										.setKeys("newUlFilesRecVOList", JSON.toJSONString(newUlFilesRecVOList))
										.info();
							}
						}
					} catch (BaseException ex) {
						BaseLogUtils.newWebLogger("新增挂靠变更流程资料失败,业务异常").setLogOperType(LogOperEnum.REQ)
								.setSysCd(CurrentThreadContext.getCurrentSysCd())
								.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
								.setBussinessId(BusinessIdConstant.LOG_SQOT_MANAGER_CD)
								.setWarning(false)
								.setThrowable(ex)
								.warn(LogExceptionEnum.COMMON_CODE_0001);
					} catch (Exception ex) {
						BaseLogUtils.newWebLogger("新增挂靠变更流程资料失败,系统异常").setLogOperType(LogOperEnum.REQ)
								.setSysCd(CurrentThreadContext.getCurrentSysCd())
								.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
								.setBussinessId(BusinessIdConstant.LOG_SQOT_MANAGER_CD)
								.setWarning(false)
								.setThrowable(ex)
								.error(LogExceptionEnum.COMMON_CODE_0099);
					}
				}
				boolean success = this.lnkCompModService.modifyBscAgain(dto, Long.valueOf(applyId), CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd());
				if (!success) {
	                result.setSuccess(BaseConstant.IS_YESNO_NO);
	                result.setInfo(SysLogConstant.LOG_CMM_UPDATE_FAIL);
					BaseLogUtils.newWebLogger("修改挂靠数据失败!").setLogOperType(LogOperEnum.RESP)
							.setSysCd(CurrentThreadContext.getCurrentSysCd())
							.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
							.setBussinessId(BusinessIdConstant.LOG_SQOT_MANAGER_CD)
							.setWarning(false)
							.warn(LogExceptionEnum.COMMON_CODE_0002);
	            }
			}

			result.setData(lnkCompId);
			BaseLogUtils.newWebLogger("新增挂靠变更数据成功").setLogOperType(LogOperEnum.RESP)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SQOT_MANAGER_CD)
					.setWarning(false)
					.setKeys("prjLnkCompVO", JSON.toJSONString(prjLnkCompVO))
					.info();
		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.newWebLogger("新增挂靠变更数据失败,业务异常").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SQOT_MANAGER_CD)
					.setWarning(false)
					.setThrowable(ex)
					.warn(LogExceptionEnum.COMMON_CODE_0001);
		} catch (Exception ex) {
			ex.printStackTrace();
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.newWebLogger("新增挂靠变更数据失败,系统异常").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SQOT_MANAGER_CD)
					.setWarning(false)
					.setThrowable(ex)
					.error(LogExceptionEnum.COMMON_CODE_0099);
		}
		return result;
	}

	/**
	 * 流程审批通过修改页面
	 */
	@RequestMapping(value = "/toModifyPage.do", method = { RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toModifyPage(HttpServletRequest request, HttpServletResponse response) {
		String id = request.getParameter("id");
		ModelAndView view = new ModelAndView("project/prjLnkCompApply/projectLnkCompApplyAdd");
		String lnkCompNm = request.getParameter("lnkCompNm");// 公司名称
		String orgCode = request.getParameter("orgCode");// 组织机构代码
		String bizLicNo = request.getParameter("bizLicNo");// 营业执照注册号
		String taxRegNo = request.getParameter("taxRegNo");// 税务登记号
		String audStsCd = request.getParameter("audStsCd");
		String isFlow = request.getParameter("isFlow");
		String isShowRate =request.getParameter("isShowRate");
		String BuOrgCd = CurrentThreadContext.getCurrentBuOrgCd();

		// 检查挂靠公司是否存在审核中的变更流程
		if (StringUtils.isNotEmpty(id)) {
			boolean auditStatus = this.prjLnkCompService.checkLnkCompFLowStatus(Long.valueOf(Long.valueOf(id)),false);
			if (auditStatus) {
				view.addObject("auditStatus", 1); // 变更审核中标识 ，前台主要字段不能修改
			} else {
				view.addObject("auditStatus", 0); // 前台字段都能修改
			}
		}

		// 挂靠公司关联人员类型
		List<KeyValueVO> prjLnkCompRlRsnTypList = prjLnkCompService.getPrjLnkCompRlRsnTypList();
		// 获取证件类型
		List<KeyValueVO> certTypCdList = prjLnkCompService.getCertTypCdList();
		view.addObject("certTypCdList", JSON.toJSONString(certTypCdList));
		view.addObject("rlRsnTypListJSON", JSON.toJSONString(prjLnkCompRlRsnTypList));
		PrjLnkCompVO prjLnkCompVO = null;
		String defCodNm = "";
		for (KeyValueVO keyValueVO : certTypCdList) {
			if (keyValueVO.getKey().equals(PrjLnkCompRelInfoConstant.CODE_CERT_TYP_DEF_CD)) {
				defCodNm = keyValueVO.getValue();
			}
		}

		//必填联系人类型
		List<SysDictionaryDTO> mustAddRlPsnTypCds = this.sysDictionaryApiService.searchGroupAll(CurrentThreadContext.getCurrentSysCd(),CurrentThreadContext.getCurrentOrgCd(),DictionaryConstant.CODE__PRJ_LNK_COMP_RL_PSN_TYP_CD);
		List<String> mustAddRlPsns = null ;
		List<String> noAddRlPsns = null ;
		if(CollectionUtils.isNotEmpty(mustAddRlPsnTypCds)){
			mustAddRlPsns = new ArrayList<>(mustAddRlPsnTypCds.size());
			noAddRlPsns = new ArrayList<>(mustAddRlPsnTypCds.size());
			for(SysDictionaryDTO dto : mustAddRlPsnTypCds){
				if(BaseConstant.IS_YESNO_YES == dto.getIsSysDef()){
					mustAddRlPsns.add(dto.getCode());
				}else if(2 == dto.getIsSysDef()){
					noAddRlPsns.add(dto.getCode());
				}
			}
		}
		view.addObject("mustAddRlPsnTypCdJSON", null == mustAddRlPsns ? null :JSON.toJSON(mustAddRlPsns));
		view.addObject("noAddRlPsnTypCdJSON", null == noAddRlPsns ? null :JSON.toJSON(noAddRlPsns));

		List<KeyValueVO> keyValueList = prjLnkCompService.getOwnerCdList();
		List<PrjLnkCompRlPsnVO> list = new ArrayList<PrjLnkCompRlPsnVO>();
		Map<String, PrjLnkCompRlPsnVO> map = new HashMap<String, PrjLnkCompRlPsnVO>();
		if (CollectionUtils.isNotEmpty(prjLnkCompRlRsnTypList)) {
			// 重要联系人类型不为其它时，保存到list中
			for (KeyValueVO keyValueVO : prjLnkCompRlRsnTypList) {
				if (!keyValueVO.getKey().equals(PrjLnkCompRelInfoConstant.CODE_RL_TYP_CD_5)
						&& (CollectionUtils.isNotEmpty(mustAddRlPsns) && mustAddRlPsns.contains(keyValueVO.getKey()) || CollectionUtils.isEmpty(mustAddRlPsns)) ) {
					PrjLnkCompRlPsnVO rlPsnVO = new PrjLnkCompRlPsnVO();
					rlPsnVO.setRlTypCd(keyValueVO.getKey());
					rlPsnVO.setRlTypCdNm(keyValueVO.getValue());
					rlPsnVO.setCertTypCd(PrjLnkCompRelInfoConstant.CODE_CERT_TYP_DEF_CD);
					rlPsnVO.setCertTypCdNm(defCodNm);
					rlPsnVO.setIsSysDef(BaseConstant.IS_YESNO_YES);
					rlPsnVO.setIsVerify(BaseConstant.IS_YESNO_NO);
					rlPsnVO.setIsDefault(BaseConstant.IS_YESNO_YES);
					list.add(rlPsnVO);
					map.put(keyValueVO.getKey(), rlPsnVO);
				}
			}
		}
		Collections.sort(list, new Comparator<PrjLnkCompRlPsnVO>() {

			@Override
			public int compare(PrjLnkCompRlPsnVO o1, PrjLnkCompRlPsnVO o2) {
				// TODO Auto-generated method stub
				return o2.getIsSysDef().compareTo(o1.getIsDefault());
			}
		});

		ListPageVO<PrjLnkCompRlPsnVO> listPage = new ListPageVO<PrjLnkCompRlPsnVO>(list, list.size());

		if (StringUtils.isNotBlank(id)) {
			// 获取保存的联系人信息
			prjLnkCompVO = this.prjLnkCompService.selectPrjLnkCompByIdAndBuOrgCd(Long.valueOf(id));
			List<PrjLnkCompRlPsnVO> rlList = prjLnkCompVO.getRlPsnList();
			// 将已经存在的联系人信息从list中删除
			if (rlList != null && rlList.size() > 0) {
				for (PrjLnkCompRlPsnVO prjLnkCompRlPsnVO : rlList) {
					if (map.containsKey(prjLnkCompRlPsnVO.getRlTypCd())) {
						map.remove(prjLnkCompRlPsnVO.getRlTypCd());
					}
				}
				for (Map.Entry<String, PrjLnkCompRlPsnVO> entry : map.entrySet()) {
					rlList.add(entry.getValue());
				}
				listPage = new ListPageVO<PrjLnkCompRlPsnVO>(rlList, rlList.size());
			}
			SplCommPropInfoQC splCommPropQC = new SplCommPropInfoQC();
			splCommPropQC.setIsValid(BaseConstant.IS_YESNO_YES);
			splCommPropQC.setPropTypCd("002");
			splCommPropQC.setIsDel(BaseConstant.IS_YESNO_NO);
			splCommPropQC.setDataId(Long.valueOf(id));
			List<SplCommPropInfoDTO> commPropInfoDTOList = this.splCommPropInfoApiService.searchList(splCommPropQC);
			splCommPropQC.setIsValid(2);
			List<SplCommPropInfoDTO> commPropInfoDTOList2 = this.splCommPropInfoApiService.searchList(splCommPropQC);
			if(CollectionUtils.isNotEmpty(commPropInfoDTOList2)){
				commPropInfoDTOList = commPropInfoDTOList2;
			}
			if(CollectionUtils.isNotEmpty(commPropInfoDTOList)){
				String propinfo = "" ;
				for (SplCommPropInfoDTO commPropInfoDTO:commPropInfoDTOList) {
					propinfo +=commPropInfoDTO.getPropInfo();
					propinfo+=";";
				}
				prjLnkCompVO.setPropCd(propinfo.substring(0,propinfo.length()-1));
				SplCarsGuarDtlInfoQC carsGuarQC = new SplCarsGuarDtlInfoQC();
				carsGuarQC.setIsValid(BaseConstant.IS_YESNO_YES);
				carsGuarQC.setIsDel(BaseConstant.IS_YESNO_NO);
				carsGuarQC.setLnkId(Long.valueOf(id));
				List<SplCarsGuarDtlInfoDTO> carsGuarDTOList = this.splCarsGuarDtlInfoApiService.searchList(carsGuarQC);
				carsGuarQC.setIsValid(2);
				List<SplCarsGuarDtlInfoDTO> carsGuarDTOList2 = this.splCarsGuarDtlInfoApiService.searchList(carsGuarQC);

				if(CollectionUtils.isNotEmpty(carsGuarDTOList2)){
					carsGuarDTOList = carsGuarDTOList2;
				}
				if(CollectionUtils.isNotEmpty(carsGuarDTOList)){
					SplCarsGuarDtlInfoDTO carsGuarDtlInfoDTO = carsGuarDTOList.get(0);
					prjLnkCompVO.setValidTmStar(carsGuarDtlInfoDTO.getValidTmStar());
					prjLnkCompVO.setValidTmEnd(carsGuarDtlInfoDTO.getValidTmEnd());
					prjLnkCompVO.setStopTruckRate(carsGuarDtlInfoDTO.getStopTruckRate());
					prjLnkCompVO.setRoadBicycleRate(carsGuarDtlInfoDTO.getRoadBicycleRate());
				}
			}
		} else {
			prjLnkCompVO = new PrjLnkCompVO();
			prjLnkCompVO.setLnkCompNm(lnkCompNm);
			prjLnkCompVO.setOrgCode(orgCode);
			prjLnkCompVO.setBizLicNo(bizLicNo);
			prjLnkCompVO.setTaxRegNo(taxRegNo);
		}

		// 可支持挂靠项目类型所有集合--PRJ0148
		// 可支持挂靠项目类型默认集合
		List<SysDictionaryDTO> prjTypCdList = this.sysDictionaryApiService.searchGroup(SplSystemConstant.SPL_SYS_CD,
				SplSystemConstant.DEFAULT_ORG_CD, PrjLnkCompRelInfoConstant.SUPP_LNK_PRJ_TYP_DIC_CODE);
		if (CollectionUtils.isNotEmpty(prjTypCdList)) {
			List<KeyValueVO> allSuppLnkPrjTypCdList = new ArrayList<>(prjTypCdList.size());
			StringBuilder defaultSuppLnkPrjTypCdString = null;
			KeyValueVO keyValueVO ;
			for (SysDictionaryDTO dto : prjTypCdList) {
				keyValueVO = new KeyValueVO();
				keyValueVO.setKey(dto.getCode());
				keyValueVO.setValue(dto.getCodeNm());
				allSuppLnkPrjTypCdList.add(keyValueVO);
				if (dto.getIsSysDef() == BaseConstant.IS_YESNO_YES) {
					if (null == defaultSuppLnkPrjTypCdString) {
						defaultSuppLnkPrjTypCdString = new StringBuilder();
						defaultSuppLnkPrjTypCdString.append(dto.getCode());
					} else {
						defaultSuppLnkPrjTypCdString.append(";").append(dto.getCode());
					}
				}
			}
			view.addObject("suppLnkPrjTypCdListJson", JSONArray.fromObject(allSuppLnkPrjTypCdList.toArray()));
			if (null != defaultSuppLnkPrjTypCdString) {
				view.addObject("defaultSuppLnkPrjTypCdListJson", defaultSuppLnkPrjTypCdString.toString());
			}
		}

		List<SysDictionaryDTO> propList = this.sysDictionaryApiService.searchGroup(SplSystemConstant.FL_SYS_CD,
				SplSystemConstant.DEFAULT_ORG_CD, "SPL0061");
		List<KeyValueVO> propKvList = new ArrayList<>();
		if(CollectionUtils.isNotEmpty(propList)){
			KeyValueVO keyValueVO ;
			for (SysDictionaryDTO dictionaryDTO:propList) {
				if(StringUtils.isNotEmpty(dictionaryDTO.getCodeAttr1()) && dictionaryDTO.getCodeAttr1().equals("LNK")) {
					keyValueVO = new KeyValueVO();
					keyValueVO.setKey(dictionaryDTO.getCode());
					keyValueVO.setValue(dictionaryDTO.getCodeNm());
					propKvList.add(keyValueVO);
				}
			}
		}

		view.addObject("propCdListJson", JSONArray.fromObject(propKvList.toArray()));
		view.addObject("isShowRate", isShowRate);
        view.addObject("tabNm1", LnkCompFileCfgEnum.PRJ030.getTableNm());
        view.addObject("cfgCd1", LnkCompFileCfgEnum.PRJ030.getCode());
        view.addObject("cfgOrgCd1", LnkCompFileCfgEnum.PRJ030.getOrgCd());
        view.addObject("cfgSysCd1", LnkCompFileCfgEnum.PRJ030.getSysCd());
        view.addObject("modulePath1", LnkCompFileCfgEnum.PRJ030.getModulePath());
        view.addObject("costomerPath1", LnkCompFileCfgEnum.PRJ030.getUploadCostomerPath());
        view.addObject("rootPath1", LnkCompFileCfgEnum.PRJ030.getUploadRootPath());
        view.addObject("uploadSysCd1", LnkCompFileCfgEnum.PRJ030.getUploadSysCd());
        view.addObject("tabNm2", LnkCompFileCfgEnum.PRJ029.getTableNm());
        view.addObject("cfgCd2", LnkCompFileCfgEnum.PRJ029.getCode());
        view.addObject("cfgOrgCd2", LnkCompFileCfgEnum.PRJ029.getOrgCd());
        view.addObject("cfgSysCd2", LnkCompFileCfgEnum.PRJ029.getSysCd());
        view.addObject("modulePath2", LnkCompFileCfgEnum.PRJ029.getModulePath());
        view.addObject("costomerPath2", LnkCompFileCfgEnum.PRJ029.getUploadCostomerPath());
        view.addObject("rootPath2", LnkCompFileCfgEnum.PRJ029.getUploadRootPath());
        view.addObject("uploadSysCd2", LnkCompFileCfgEnum.PRJ029.getUploadSysCd());
		view.addObject("tabNm3", LnkCompFileCfgEnum.PRJ032.getTableNm());
		view.addObject("cfgCd3", LnkCompFileCfgEnum.PRJ032.getCode());
		view.addObject("cfgOrgCd3", LnkCompFileCfgEnum.PRJ032.getOrgCd());
		view.addObject("cfgSysCd3", LnkCompFileCfgEnum.PRJ032.getSysCd());
		view.addObject("modulePath3", LnkCompFileCfgEnum.PRJ032.getModulePath());
		view.addObject("costomerPath3", LnkCompFileCfgEnum.PRJ032.getUploadCostomerPath());
		view.addObject("rootPath3", LnkCompFileCfgEnum.PRJ032.getUploadRootPath());
		view.addObject("uploadSysCd3", LnkCompFileCfgEnum.PRJ032.getUploadSysCd());

		view.addObject("propTabNm", LnkCompFileCfgEnum.PRJ034.getTableNm());
		view.addObject("propCfgCd", LnkCompFileCfgEnum.PRJ034.getCode());
		view.addObject("propCfgOrgCd", LnkCompFileCfgEnum.PRJ034.getOrgCd());
		view.addObject("propCfgSysCd", LnkCompFileCfgEnum.PRJ034.getSysCd());
		view.addObject("propModulePath", LnkCompFileCfgEnum.PRJ034.getModulePath());
		view.addObject("propCostomerPath1", LnkCompFileCfgEnum.PRJ034.getUploadCostomerPath());
		view.addObject("propRootPath", LnkCompFileCfgEnum.PRJ034.getUploadRootPath());
		view.addObject("propUploadSysCd", LnkCompFileCfgEnum.PRJ034.getUploadSysCd());

		SysUlDatCfgQueryCondition ulDatCfgQueryCondition = new SysUlDatCfgQueryCondition();
		ulDatCfgQueryCondition.setSysCd(LnkCompFileCfgEnum.PRJ029.getSysCd());//系统代码
		ulDatCfgQueryCondition.setOrgCd(LnkCompFileCfgEnum.PRJ029.getOrgCd());
		ulDatCfgQueryCondition.setIsValid(BaseConstant.IS_YESNO_YES);
		ulDatCfgQueryCondition.setIsDel(BaseConstant.IS_YESNO_NO);
		List<String> cfgCdList = new ArrayList<>();
		cfgCdList.add(LnkCompFileCfgEnum.PRJ029.getCode());//配置编号
		cfgCdList.add(LnkCompFileCfgEnum.PRJ030.getCode());
		cfgCdList.add(LnkCompFileCfgEnum.PRJ032.getCode());
		ulDatCfgQueryCondition.setCfgCdList(cfgCdList);//配置编号集合
		List<SysUlDatCfgDTO> allCfgCdList = this.uploadApiService.searchSysUlDatCfgList(ulDatCfgQueryCondition);
		if (CollectionUtils.isNotEmpty(allCfgCdList)) {
			List<SysUlDatCfgDtlDTO> allCfgDtlCdList = new ArrayList<>();
			for (SysUlDatCfgDTO dto : allCfgCdList) {
				allCfgDtlCdList.addAll(dto.getSysUlDatCfgDtlDTOList());
			}
			view.addObject("allCfgDtlCdList", JSON.toJSONString(allCfgDtlCdList));
		}

		view.addObject("rlPsnList", JSON.toJSONString(listPage));

		view.addObject("keyValueList", keyValueList);
		view.addObject("id", id);
		// view.addObject("BuOrgCd", BuOrgCd);
		view.addObject("prjLnkComp", prjLnkCompVO);
		view.addObject("rlRsnTypList", JSON.toJSONString(prjLnkCompVO.getRlPsnList()));
		view.addObject("audStsCd", audStsCd);
		view.addObject("isFlow", isFlow);
		BaseLogUtils.newWebLogger("跳转到修改挂靠公司页面").setLogOperType(LogOperEnum.REQ)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_SQOT_MANAGER_CD)
				.setWarning(false)
				.setKeys("id", id)
				.info();
		return view;
	}

	public PrjLnkCompVO getPrjLnkCompParam(HttpServletRequest request) {// getPrjLnkCompApplyParam
		PrjLnkCompVO prjLnkCompVO = new PrjLnkCompVO();
		String lnkCompNm = request.getParameter("lnkCompNm");// 挂靠公司名称
		String ownerCd = request.getParameter("ownerCd");// 挂靠公司归属
		String officeAddr = request.getParameter("officeAddr");// 所在地
		String majorBiz = request.getParameter("majorBiz");// 主营项目类别
		String bizLicNo = request.getParameter("bizLicNo");// 营业执照注册号
		String compTyp = request.getParameter("compTyp");// 企业类型
		String regAddr = request.getParameter("regAddr");// 注册地址
		String regDt = request.getParameter("regDt");// 成立日期
		String taxRegNo = request.getParameter("taxRegNo");// 税务登记号
		String orgCode = request.getParameter("orgCode");// 组织机构代码
		String expDt = request.getParameter("expDt");// 道路运输许可证有效期
		String bizScope = request.getParameter("bizScope");// 经营范围
		String corpRep = request.getParameter("corpRep");// 法人代表
		String idNo = request.getParameter("idNo");// 法人身份证号
		String totLnkQty = request.getParameter("totLnkQty");// 自有车辆备案数量
		String ownQty = request.getParameter("ownQty");// 自有车辆备案数量
		String ourTotLnkQyt = request.getParameter("ourTotLnkQyt");// 在我司累积挂靠车辆
		String rem = request.getParameter("rem");// 备注
		String lnkMp = request.getParameter("lnkMp");// 联系人手机号码
		String lnkNm = request.getParameter("lnkNm");// 联系人
		String lnkPost = request.getParameter("lnkPost");// 联系人职务
		String fileParams = request.getParameter("fileParams");
		String actCtrlNm = request.getParameter("actCtrlNm");// 实际控制人
		String actCtrlMp = request.getParameter("actCtrlMp");// 实际联系人电话
		String rlPsnList = request.getParameter("rlPsnList");

		String flag = request.getParameter("flag");
		String succ = request.getParameter("succ");


		String rgnCyCd = request.getParameter("rgnCyCd");
		String rgnPrCd = request.getParameter("rgnPrCd");

		String suppLnkPrjTypCd = request.getParameter("suppLnkPrjTypCd");//可支持挂靠项目类型

		String isUploadLoa = request.getParameter("isUploadLoa");

		String isRecycleLoa = request.getParameter("isRecycleLoa");

		List<PrjLnkCompRlPsnVO> list = new ArrayList<PrjLnkCompRlPsnVO>();
		List<PrjLnkCompRlPsnVO> prjRlPsn = new ArrayList<PrjLnkCompRlPsnVO>();
		if (StringUtils.isNotBlank(rlPsnList)) {
			list = JSON.parseArray(rlPsnList, PrjLnkCompRlPsnVO.class);

			for (PrjLnkCompRlPsnVO dto : list) {
				if (dto.getIsDefault() == null || !dto.getIsDefault().equals(1)) {
					PrjLnkCompRlPsnVO vo = new PrjLnkCompRlPsnVO();
					if (dto.getId() != null) {
						vo.setId(dto.getId());
					}
					vo.setRlTypCd(dto.getRlTypCd());// 关联类型-变更
					vo.setRlNm(dto.getRlNm());// 姓名-变更
					vo.setCertNo(dto.getCertNo());// 证件号码-变更
					vo.setTel(dto.getTel());// 联系电话-变更
					vo.setCertTypCd(dto.getCertTypCd());// 证件类型-变更
					prjRlPsn.add(dto);
				}
			}

			for (PrjLnkCompRlPsnVO prjLnkCompRlPsnVO : list) {
				// 验证主要联系人信息是否输入
				if (StringUtils.isBlank(prjLnkCompRlPsnVO.getRlNm())) {
					throw new BaseException(BaseExceptionConstant.COMMON_0001, "主要人员名称不能为空！");
				}
				if (StringUtils.isBlank(prjLnkCompRlPsnVO.getRlTypCd())) {
					throw new BaseException(BaseExceptionConstant.COMMON_0001, "主要人员联系人类型不能为空！");
				}
				if (StringUtils.isEmpty(prjLnkCompRlPsnVO.getIsDefault())) {
					continue ;
				}
				if (StringUtils.isBlank(prjLnkCompRlPsnVO.getCertTypCd()) && "1".equals(prjLnkCompRlPsnVO.getIsDefault().toString())) {
					throw new BaseException(BaseExceptionConstant.COMMON_0001, "主要人员证件类型不能为空！");
				}
				if (StringUtils.isBlank(prjLnkCompRlPsnVO.getCertNo()) && "1".equals(prjLnkCompRlPsnVO.getIsDefault().toString())) {
					throw new BaseException(BaseExceptionConstant.COMMON_0001, "主要人员证件号不能为空！");
				}
				if ("1".equals(prjLnkCompRlPsnVO.getIsDefault().toString())) {
					if (prjLnkCompRlPsnVO.getCertTypCd().equals(PrjLnkCompRelInfoConstant.CODE_CERT_TYP_DEF_CD)) {
						if (!StringUtils.isIdCardNumber(prjLnkCompRlPsnVO.getCertNo())) {
							throw new BaseException(BaseExceptionConstant.COMMON_0001, "身份证号格式不正确");
						}
					}
				}
				if (StringUtils.isBlank(prjLnkCompRlPsnVO.getTel()) && "1".equals(prjLnkCompRlPsnVO.getIsDefault().toString())) {
					throw new BaseException(BaseExceptionConstant.COMMON_0001, "主要人员联系电话不能为空！");
				}
				if ("1".equals(prjLnkCompRlPsnVO.getIsDefault().toString())) {
					if (!StringUtils.checkMobileNumber(prjLnkCompRlPsnVO.getTel())) {
						throw new BaseException(BaseExceptionConstant.COMMON_0001, "主要人员联系电话格式不正确");
					}
				}

				// 验证身份证号码的有效性
				if (DictionaryConstant.CODE_CERT_TYP_CD_0.equals(prjLnkCompRlPsnVO.getCertTypCd())) {
					//this.validateIdCard(prjLnkCompRlPsnVO.getRlNm(), prjLnkCompRlPsnVO.getCertNo());
				}

				// 无呈报人驳回修改变更标识验证主要联系人是否输入
				if (!flag.equals("flag")) {
					//验证必填联系人是否填写start
					Map<String, SysDictionaryDTO> lnkCompRLTypCdMap = this.sysDictionaryApiService.searchGroupToObjMap(
							CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd(),
							DictionaryConstant.CODE__PRJ_LNK_COMP_RL_PSN_TYP_CD);
					//必须维护联系人类型
					List<String> mustRlTypCdList = new ArrayList<String>();
					for (Entry<String, SysDictionaryDTO> entry : lnkCompRLTypCdMap.entrySet()) {
						if (BaseConstant.IS_YESNO_YES == entry.getValue().getIsSysDef()) {
							mustRlTypCdList.add(entry.getKey());
						}
					}
					//前端传回的联系人类型集合
					List<String> rlTypCdList = new ArrayList<String>();
					for (PrjLnkCompRlPsnVO lnkCompRlPsnVO : list) {
						if (null != lnkCompRlPsnVO) {
							rlTypCdList.add(lnkCompRlPsnVO.getRlTypCd());
						}
					}
					for (String string : mustRlTypCdList) {
						if (!rlTypCdList.contains(string)) {
							throw new BaseException(BaseExceptionConstant.COMMON_0001,
									"请维护" + lnkCompRLTypCdMap.get(string).getCodeNm() + "信息。");
						}
					}
					//验证必填联系人是否填写end
				}
			}
		}
		Date regDate = null;
		if (StringUtils.isNotBlank(regDt)) {
			regDate = DateUtils.formatStringToDate(regDt, DateUtils.YYYY_MM_DD);
			if (DateUtils.after(new Date(), regDate)) {
				throw new BaseException(BaseExceptionConstant.COMMON_0001, "成立日期应在当前日期之前");
			}
		}

		if (StringUtils.isNotBlank(totLnkQty)) {
			if (!StringUtils.isUnsignedNumeric(totLnkQty)) {
				throw new BaseException(BaseExceptionConstant.COMMON_0001, "现累计挂靠数量应为数字");
			}
		}
		if (StringUtils.isNotBlank(ownQty)) {
			if (!StringUtils.isUnsignedNumeric(ownQty)) {
				throw new BaseException(BaseExceptionConstant.COMMON_0001, "自有车辆备案数量应为数字");
			}
		}
		String buOrgCd = CurrentThreadContext.getCurrentBuOrgCd();
		Date expDate = null;
		if (StringUtils.isNotBlank(expDt)) {
			expDate = DateUtils.formatStringToDate(expDt, DateUtils.YYYY_MM_DD);
			if (DateUtils.before(new Date(), expDate)) {
				throw new BaseException(BaseExceptionConstant.COMMON_0001, "道路运输许可证有效期应在当前日期之后");
			}
		}

		if (StringUtils.isBlank(lnkCompNm)) {
			throw new BaseException(BaseExceptionConstant.COMMON_0001, " 挂靠公司名称不能为空");
		}

		if (StringUtils.isBlank(succ)) {
			throw new BaseException(BaseExceptionConstant.COMMON_0001, "统一社会信用代码不能为空");
		}

		// 解析附件上传信息
		if (StringUtils.isNotBlank(fileParams)) {
			List<SysUlFilesRecVO> fileList = new ArrayList<SysUlFilesRecVO>();
			fileList = JSON.parseArray(fileParams, SysUlFilesRecVO.class);
			if(CollectionUtils.isNotEmpty(fileList)){
				for (SysUlFilesRecVO sysUlFilesRecVO : fileList) {
					if ("1".equals(ownerCd)) {
						sysUlFilesRecVO.setAbsLocPath(PropertiesCacheUtils.getProperty(LnkCompFileCfgEnum.PRJ030.getUploadRootPath())+sysUlFilesRecVO.getFilePath());
					} else if ("2".equals(ownerCd)){
						sysUlFilesRecVO.setAbsLocPath(PropertiesCacheUtils.getProperty(LnkCompFileCfgEnum.PRJ029.getUploadRootPath())+sysUlFilesRecVO.getFilePath());
					} else {
						sysUlFilesRecVO.setAbsLocPath(PropertiesCacheUtils.getProperty(LnkCompFileCfgEnum.PRJ032.getUploadRootPath())+sysUlFilesRecVO.getFilePath());
					}
				}
			}
			prjLnkCompVO.setFileList(fileList);
		}

		if (StringUtils.isNotEmpty(suppLnkPrjTypCd)) {
			prjLnkCompVO.setSuppPrjTypCd(suppLnkPrjTypCd);
			String[] split = suppLnkPrjTypCd.split(";");
			List<String> suppLnkPrjTypCdList = new ArrayList<>(split.length);
			for (String s : split) {
				suppLnkPrjTypCdList.add(s);
			}
			prjLnkCompVO.setSuppPrjTypCdList(suppLnkPrjTypCdList);
		}

		prjLnkCompVO.setSucc(succ);
		prjLnkCompVO.setRlPsnList(prjRlPsn);
		prjLnkCompVO.setActCtrlMp(actCtrlMp);
		prjLnkCompVO.setActCtrlNm(actCtrlNm);
		prjLnkCompVO.setLnkCompNm(lnkCompNm);
		prjLnkCompVO.setOwnerCd(ownerCd);
		prjLnkCompVO.setOfficeAddr(officeAddr);
		prjLnkCompVO.setMajorBiz(majorBiz);
		// prjLnkCompVO.setBizLicNo(bizLicNo);
		prjLnkCompVO.setCompTyp(compTyp);
		prjLnkCompVO.setRegAddr(regAddr);
		prjLnkCompVO.setRegDt(regDate);
		// prjLnkCompVO.setTaxRegNo(taxRegNo);
		// prjLnkCompVO.setOrgCode(orgCode);
		prjLnkCompVO.setExpDt(expDate);
		prjLnkCompVO.setBizScope(bizScope);
		prjLnkCompVO.setCorpRep(corpRep);
		prjLnkCompVO.setIdNo(idNo);
		prjLnkCompVO.setOwnQty(ownQty);
		if (StringUtils.isNotBlank(ourTotLnkQyt)) {
			prjLnkCompVO.setOurTotLnkQyt(Integer.parseInt(ourTotLnkQyt));
		}
		prjLnkCompVO.setRem(rem);
		prjLnkCompVO.setLnkMp(lnkMp);
		prjLnkCompVO.setLnkNm(lnkNm);
		prjLnkCompVO.setLnkPost(lnkPost);
		prjLnkCompVO.setTotLnkQty(totLnkQty);
		prjLnkCompVO.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
		prjLnkCompVO.setMdfTm(new Date());
		prjLnkCompVO.setRgnPrCd(rgnPrCd);
		prjLnkCompVO.setRgnCyCd(rgnCyCd);
		prjLnkCompVO.setSuppPrjTypCd(suppLnkPrjTypCd);
		// prjLnkCompVO.setOrgCode(orgCode);
		if(StringUtils.isNotEmpty(isRecycleLoa)){
			prjLnkCompVO.setIsRecycleLoa(Integer.valueOf(isRecycleLoa));
		}
		if(StringUtils.isNotEmpty(isUploadLoa)){
			prjLnkCompVO.setIsUploadLoa(Integer.valueOf(isUploadLoa));
		}
		return prjLnkCompVO;
	}

	/**
	 * 通过姓名身份证号码验证信息是否正确
	 *
	 * @param cstNm
	 * @param certNo
	 * @return
	 * @throws BaseException
	 */
	private void validateIdCard(String cstNm, String certNo) {
		// 验证身份证号格式
		this.checkVIDInfoItem(cstNm, certNo);
		// 调用第三方接口验证证件信息
		this.validCert(cstNm, certNo, "身份证信息验证未通过!", "validateIdCard");
	}

	/**
	 * 检查主要人员重要信息项
	 *
	 * @param cstNm
	 *            姓名
	 * @param certNo
	 *            证件号码
	 */
	private void checkVIDInfoItem(String cstNm, String certNo) {
		String certTypCd = DictionaryConstant.CODE_CERT_TYP_CD_0;

		// 验证必填项及长度
		if (StringUtils.isBlank(cstNm) || cstNm.length() > 20 || !StringUtils.isCustomerName(cstNm)) {
			throw new BaseException(BaseExceptionConstant.COMMON_0001,
					"【" + certNo + "】" + PrjLnkCompRelInfoConstant.LOG_VALID_NM);
		}

		if (StringUtils.isBlank(certNo)) {
			throw new BaseException(BaseExceptionConstant.COMMON_0001,
					"【" + cstNm + "】" + PrjLnkCompRelInfoConstant.LOG_VALID_CERT_NO_EMPTY);
		}

		if (certTypCd.equals(DictionaryConstant.CODE_CERT_TYP_CD_0) && !StringUtils.isIdCardNumber(certNo)) {
			throw new BaseException(BaseExceptionConstant.COMMON_0001,
					"【" + cstNm + "】" + PrjLnkCompRelInfoConstant.LOG_VALID_CERT_NO_ERROR);
		}
	}

	/**
	 * 证件验证
	 *
	 * @param certNm
	 *            证件名称
	 * @param certNo
	 *            证件号码
	 * @param errorDesc
	 *            错误信息
	 * @Param funName
	 */
	private CstValidCardInfoVO validCert(String certNm, String certNo, String errorDesc, String funName) {
		CstValidCardInfoVO cstValidCardInfoVO = this.cstBscInfoService.validateCstCert(certNm, certNo);
		if (!cstValidCardInfoVO.getSuccess()) {
			// 第三方验证未通过
			BaseLogUtils.newWebLogger(errorDesc).setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SQOT_MANAGER_CD)
					.setWarning(false)
					.setKeys("certNm", certNm)
					.setKeys("certNo", certNo)
					.warn(LogExceptionEnum.COMMON_CODE_0002);
			throw new BaseException(BaseExceptionConstant.COMMON_0001, errorDesc);
		}
		return cstValidCardInfoVO;
	}

	/**
	 * 启动变更工作流程
	 *
	 * @param request
	 * @param applyId
	 */
	private FlowStartedDTO addFlowStart(HttpServletRequest request, Long applyId) {
		String procDefKey = request.getParameter("procDefKey");
		String procDefId = request.getParameter("procDefId");
		String procNo = request.getParameter("procNo");
		String propCd = request.getParameter("porpCd");
		FlowStartParamsDTO flowStartParamsDTO = new FlowStartParamsDTO();
		try {
			HashMap<String, Object> param = new HashMap<>();
        	String ownerCd = request.getParameter("ownerCd");
        	if(StringUtils.isNotEmpty(ownerCd) && "2".equals(ownerCd)){
        		param.put("isOwnerCd", BaseConstant.IS_YESNO_NO);
        	}else{
        		param.put("isOwnerCd", BaseConstant.IS_YESNO_YES);
        	}
        	if(StringUtils.isNotEmpty(ownerCd) && "2".equals(ownerCd) && StringUtils.isNotEmpty(propCd)){
				param.put("isCarsGuar",1);
			}else{
				param.put("isCarsGuar",0);
			}

			// 流程定义Key和流程定义ID 如果是前端选择的则直接指定,如果不是则系统自动按照配置选择唯一一条记录,如果找不到会提示
			flowStartParamsDTO.setAudStsCd(FlowConstant.FLOW_CHECK_STATE_IN);

			flowStartParamsDTO.setWordsInTheTable(PrjLnkCompRelInfoConstant.FLOW_S_H_LNK);
			// 流程定义标识(必填)
			flowStartParamsDTO.setProcDefKey(procDefKey);
			// 流程定义ID(必填)
			flowStartParamsDTO.setProcDefId(procDefId);
			// 流程定义名称(自定义)
			flowStartParamsDTO.setProcNo(procNo);

			flowStartParamsDTO.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
			// 业务数据主键(必填)
			flowStartParamsDTO.setBusinessKey(applyId + "");
			flowStartParamsDTO.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
			flowStartParamsDTO.setBuOrgCd(CurrentThreadContext.getCurrentBuOrgCd());
			flowStartParamsDTO.setSysCd(CurrentThreadContext.getCurrentSysCd());
			flowStartParamsDTO.setInitiator(String.valueOf(CurrentThreadContext.getCurrentUserId()));
			flowStartParamsDTO.setInitiatorNm(CurrentThreadContext.getCurrentUserName());
			flowStartParamsDTO.setProcPriority(FlowConstant.FLOW_PRIORITY_EMERGENCY);// 优先级,可以在界面定义
			// 业务类型(必填)-用于区分操作表标识
			flowStartParamsDTO.setBusinessType(FlowConstant.FLOW_BUSINESS_TYP_LNK);// 确认用不用
			// 模块类型(流程业务分类): 针对直接启动流程的业务使用
			flowStartParamsDTO.setModelTyp(FlowConstant.FLOW_MODEL_TYP_LNK_CHG);// 需要和流程配置中的模块类型匹配
			flowStartParamsDTO.setSearchDesc(CurrentThreadContext.getCurrentOrgDispNm() + "挂靠公司信息变更流程大字段参数未定!");
			flowStartParamsDTO.setStartParams(param);
			DataResultDTO dataResultDTO = this.flowApiService.noTransFlowStart(flowStartParamsDTO);
			if(null!=dataResultDTO && null!=dataResultDTO.getData()){
				FlowStartedDTO flowStartedDTO = (FlowStartedDTO) dataResultDTO.getData();
				return flowStartedDTO;
			}
		} catch (BaseException e) {
			BaseLogUtils.newWebLogger("启动变更工作流程,业务异常").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SQOT_MANAGER_CD)
					.setWarning(false)
					.setThrowable(e)
					.warn(LogExceptionEnum.COMMON_CODE_0001);
			e.getStackTrace();
		} catch (Exception e) {
			BaseLogUtils.newWebLogger("启动变更工作流程,系统异常").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SQOT_MANAGER_CD)
					.setWarning(false)
					.setThrowable(e)
					.error(LogExceptionEnum.COMMON_CODE_0099);
			e.getStackTrace();
		}
		return null;
	}

	@RequestMapping(value = "/initRlPsnList.do", method = { RequestMethod.GET, RequestMethod.POST })
	@ResponseBody
	public Object initRlPsn(HttpServletRequest request, HttpServletResponse response) throws BaseException{

		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,"获取联系人信息成功");

		String compId = request.getParameter("compId");
		String compApplyId = request.getParameter("compApplyId");
		if(StringUtils.isEmpty(compId) && StringUtils.isEmpty(compApplyId)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("请求参数不完整,compId="+compId+",compApplyId="+compApplyId);
			return result ;
		}
		PrjLnkCompRlPsnQC qc = new PrjLnkCompRlPsnQC();
		qc.setPrjLnkCompId(Long.valueOf(compId));
		qc.setIsDel(BaseConstant.IS_YESNO_NO);
		qc.setIsValid(9);
		//关系人员表信息
		List<PrjLnkCompRlPsnVO> list = this.prjLnkCompRlPsnService.selectList(qc);
		list = this.setRlPsnListInFlow(Long.valueOf(compApplyId), list);
		ListPageVO<PrjLnkCompRlPsnVO> listPageVO = new ListPageVO<>();
		listPageVO.setRows(list);
		return listPageVO;
	}

	private List<PrjLnkCompRlPsnVO> setRlPsnList(List<PrjLnkCompRlPsnVO> list,Long applyId,Long compId){

		LnkCompModDtlQC condition = new LnkCompModDtlQC();
		condition.setModId(applyId);
		condition.setIsDel(BaseConstant.IS_YESNO_NO);
		condition.setTabNm(LnkCompConstant.LNK_COMP_RL_PSN_FLOW_S_H_LNK_TAB);
		List<LnkCompModDtlDTO> lnkCompModDtlVOs = lnkCompModDtlService.searchList(condition );

		// 获取证件类型
		List<KeyValueVO> certTypCdList = prjLnkCompService.getCertTypCdList();
		//获取默认证件类型名称
        String defCodNm = "";
        for (KeyValueVO keyValueVO : certTypCdList) {
            if (keyValueVO.getKey().equals(SplInfoConstant.CODE_CERT_TYP_DEF_CD)) {
                defCodNm = keyValueVO.getValue();
                break;
            }
        }
        //必填联系人类型
        List<SysDictionaryDTO> mustAddRlPsnTypCds = this.sysDictionaryApiService.searchGroupAll(CurrentThreadContext.getCurrentSysCd(),CurrentThreadContext.getCurrentOrgCd(),DictionaryConstant.CODE__PRJ_LNK_COMP_RL_PSN_TYP_CD);
        List<String> mustAddRlPsns = null ;
        if(CollectionUtils.isNotEmpty(mustAddRlPsnTypCds)){
            mustAddRlPsns = new ArrayList<>(mustAddRlPsnTypCds.size());
            for(SysDictionaryDTO dto : mustAddRlPsnTypCds){
                if(BaseConstant.IS_YESNO_YES == dto.getIsSysDef()){
					mustAddRlPsns.add(dto.getCode());
				}
            }
        }
        //挂靠公司关联人员类型
        List<KeyValueVO> rlRsnTypList = prjLnkCompService.getPrjLnkCompRlRsnTypList();
        Map<String,PrjLnkCompRlPsnVO> map = new HashMap<>();
        if(CollectionUtils.isNotEmpty(rlRsnTypList)){
        	for (KeyValueVO keyValueVO : rlRsnTypList) {
        		if (CollectionUtils.isNotEmpty(mustAddRlPsns) && mustAddRlPsns.contains(keyValueVO.getKey()) || CollectionUtils.isEmpty(mustAddRlPsns)) {
		        	PrjLnkCompRlPsnVO rlPsnVO = new PrjLnkCompRlPsnVO();
		        	rlPsnVO.setRlTypCd(keyValueVO.getKey());
		        	rlPsnVO.setRlTypCdNm(keyValueVO.getValue());
		        	rlPsnVO.setCertTypCd(SplInfoConstant.CODE_CERT_TYP_DEF_CD);
		        	rlPsnVO.setCertTypCdNm(defCodNm);
		        	rlPsnVO.setIsDel(BaseConstant.IS_YESNO_NO);
		        	rlPsnVO.setIsDefault(BaseConstant.IS_YESNO_YES);
		            map.put(keyValueVO.getKey(), rlPsnVO);
        		}
        	}
        }

        if(CollectionUtils.isEmpty(list)){
        	list = new ArrayList<>();
        }

        Map<Long,PrjLcApplyRlPsnVO> applyMap = null ;
        if(StringUtils.isNotEmpty(applyId)){
        	applyMap = new HashMap<>();
        	PrjLcApplyRlPsnQueryCondition qc = new PrjLcApplyRlPsnQueryCondition();
    		qc.setPrjLnkCompApplyId(Long.valueOf(applyId));
    		// 关联人员变更表更信息
    		List<PrjLcApplyRlPsnVO> applyRlPsnVOs = this.prjLcApplyRlPsnService.searchList(qc);
    		if(CollectionUtils.isNotEmpty(applyRlPsnVOs)){
	    		for (PrjLcApplyRlPsnVO rlPsnVO : applyRlPsnVOs) {
					if(StringUtils.isNotEmpty(rlPsnVO.getPrjLnkCompRlPsnId())){
						applyMap.put(rlPsnVO.getPrjLnkCompRlPsnId(), rlPsnVO);
					}else{
						applyMap.put(rlPsnVO.getId(), rlPsnVO);
					}
				}
    		}
        }

        for (PrjLnkCompRlPsnVO rlPsnVO : list) {
			if(StringUtils.isNotEmpty(applyId)){
				if(null != rlPsnVO.getIsDefault() && rlPsnVO.getIsDefault() == 1){
					Long rlPsnId = rlPsnVO.getId();
					PrjLcApplyRlPsnVO prjLcApplyRlPsnVO = applyMap.get(rlPsnId);
					if(null != prjLcApplyRlPsnVO){
						rlPsnVO.setRlNm(prjLcApplyRlPsnVO.getRlNm());
						rlPsnVO.setCertTypCd(prjLcApplyRlPsnVO.getCertTypCd());
						rlPsnVO.setCertNo(prjLcApplyRlPsnVO.getCertNo());
						rlPsnVO.setRlTypCd(prjLcApplyRlPsnVO.getRlTypCd());
						rlPsnVO.setTel(prjLcApplyRlPsnVO.getTel());
						rlPsnVO.setApplyRlPsnId(prjLcApplyRlPsnVO.getId());
						rlPsnVO.setBrPerVerify(prjLcApplyRlPsnVO.getBrPerVerify());
						rlPsnVO.setBusInfoVerify(prjLcApplyRlPsnVO.getBusInfoVerify());
						rlPsnVO.setTdPerVerify(prjLcApplyRlPsnVO.getTdPerVerify());
						rlPsnVO.setPyPerVerify(prjLcApplyRlPsnVO.getPyPerVerify());
                        applyMap.remove(rlPsnId);
					}
				}
			}
			//如果存在必输联系人，将必输Map中联系人去除
            if (map.containsKey(rlPsnVO.getRlTypCd())) {
                map.remove(rlPsnVO.getRlTypCd());
            }
		}
        if(CollectionUtils.isMapNotEmpty(applyMap)){
        	for (PrjLcApplyRlPsnVO rlPsnVO : applyMap.values()) {
				PrjLnkCompRlPsnVO psnVO = new PrjLnkCompRlPsnVO();
				psnVO.setId(rlPsnVO.getPrjLnkCompRlPsnId());
				psnVO.setIsDefault(rlPsnVO.getIsDefault());
                if (StringUtils.isNotEmpty(compId)) {
                	psnVO.setPrjLnkCompId(compId);
                }
                psnVO.setRlNm(rlPsnVO.getRlNm());
                psnVO.setCertTypCd(rlPsnVO.getCertTypCd());
                psnVO.setCertNo(rlPsnVO.getCertNo());
                psnVO.setRlTypCd(rlPsnVO.getRlTypCd());
                psnVO.setTel(rlPsnVO.getTel());
                psnVO.setRlRem(rlPsnVO.getRlRem());
                psnVO.setApplyRlPsnId(rlPsnVO.getId());

                psnVO.setBrPerVerify(rlPsnVO.getBrPerVerify());
                psnVO.setBusInfoVerify(rlPsnVO.getBusInfoVerify());
                psnVO.setTdPerVerify(rlPsnVO.getTdPerVerify());
                psnVO.setPyPerVerify(rlPsnVO.getPyPerVerify());
                list.add(psnVO);
                //如果存在必输联系人，将必输Map中联系人去除
                if (map.containsKey(psnVO.getRlTypCd())) {
                    map.remove(psnVO.getRlTypCd());
                }
			}

        }

        if(CollectionUtils.isMapNotEmpty(map)){
        	for (Entry<String, PrjLnkCompRlPsnVO> entry : map.entrySet()) {
				list.add(entry.getValue());
			}
        }
        this.setPrdSplRlPsnDTOWithDicInfo(list);
		return list ;
	}

	private List<PrjLnkCompRlPsnVO> setRlPsnListInFlow(Long modId,List<PrjLnkCompRlPsnVO> resultList){
		LnkCompModDtlQC condition = new LnkCompModDtlQC();
		condition.setModId(modId);
		condition.setIsDel(BaseConstant.IS_YESNO_NO);
		condition.setTabNm(LnkCompConstant.LNK_COMP_RL_PSN_FLOW_S_H_LNK_TAB);
		List<LnkCompModDtlDTO> lnkCompModDtlVOs = lnkCompModDtlService.searchList(condition );
		BaseLogUtils.newWebLogger("查询挂靠变更联系人明细").setLogOperType(LogOperEnum.RESP)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_SQOT_MANAGER_CD)
				.setWarning(false)
				.setKeys("lnkCompModDtlVOs", JSON.toJSONString(lnkCompModDtlVOs))
				.info();
		Map<Long, List<LnkCompModDtlDTO>> map = new HashMap<>();
		List<Long> ids = new ArrayList<>();


		if(CollectionUtils.isNotEmpty(lnkCompModDtlVOs)){
			for (LnkCompModDtlDTO lnkCompModDtlVO: lnkCompModDtlVOs) {
				if(CommonOpTypCdEnum.MDF.getOpTypCd().equals(lnkCompModDtlVO.getModTypCd())){
					// 联系人变更类型：修改
					if(map.containsKey(lnkCompModDtlVO.getModBusId())){
						map.get(lnkCompModDtlVO.getModBusId()).add(lnkCompModDtlVO);
					}else{
						List<LnkCompModDtlDTO> modDtlDTOS = new ArrayList<>();
						modDtlDTOS.add(lnkCompModDtlVO);
						map.put(lnkCompModDtlVO.getModBusId(),modDtlDTOS);
					}
				}else if(CommonOpTypCdEnum.DEL.getOpTypCd().equals(lnkCompModDtlVO.getModTypCd())){
					// 联系人变更类型：删除
					ids.add(lnkCompModDtlVO.getModBusId());
				}
			}
		}

		for (PrjLnkCompRlPsnVO lnkCompRlPsnVO: resultList) {
			List<LnkCompModDtlDTO> dtlDTOS = map.get(lnkCompRlPsnVO.getId());
			if(CollectionUtils.isNotEmpty(dtlDTOS)){
				for (LnkCompModDtlDTO modDtlDTO:dtlDTOS) {
					Field field = null;
					try {
						// 获取field
						field = BasePrjLnkCompRlPsnVO.class.getDeclaredField(modDtlDTO.getModAttrFiled());
					} catch (NoSuchFieldException e) {
						e.printStackTrace();
					}
					field.setAccessible(true);
					try {
						// 封装lnkCompRlPsnVO
						field.set((Object) lnkCompRlPsnVO, modDtlDTO.getModConAft());
					} catch (IllegalAccessException e) {
						e.printStackTrace();
					}
				}
			}
		}

		// 排除掉变更中删除的联系人
		if(CollectionUtils.isNotEmpty(ids)){
			List<PrjLnkCompRlPsnVO> list1 = new ArrayList<PrjLnkCompRlPsnVO>();
			for (PrjLnkCompRlPsnVO dto : resultList ) {
				if(!ids.contains(dto.getId())){
					list1.add(dto);
				}
			}
			resultList = list1;
		}

		// 获取证件类型
		// 设置默认证件类型
		List<KeyValueVO> certTypCdList = prjLnkCompService.getCertTypCdList();
		//获取默认证件类型名称
        String defCodNm = "";
        for (KeyValueVO keyValueVO : certTypCdList) {
            if (keyValueVO.getKey().equals(SplInfoConstant.CODE_CERT_TYP_DEF_CD)) {
                defCodNm = keyValueVO.getValue();
                break;
            }
        }
		//必填联系人类型
        // 设置必填联系人类型
        List<SysDictionaryDTO> mustAddRlPsnTypCds = this.sysDictionaryApiService.searchGroupAll(CurrentThreadContext.getCurrentSysCd(),CurrentThreadContext.getCurrentOrgCd(),DictionaryConstant.CODE__PRJ_LNK_COMP_RL_PSN_TYP_CD);
        List<String> mustAddRlPsns = null ;
        if(CollectionUtils.isNotEmpty(mustAddRlPsnTypCds)){
            mustAddRlPsns = new ArrayList<>(mustAddRlPsnTypCds.size());
            for(SysDictionaryDTO dto : mustAddRlPsnTypCds){
                if(BaseConstant.IS_YESNO_YES == dto.getIsSysDef()){
					mustAddRlPsns.add(dto.getCode());
				}
            }
        }
        //挂靠公司关联人员类型
        List<KeyValueVO> rlRsnTypList = prjLnkCompService.getPrjLnkCompRlRsnTypList();
        Map<String,PrjLnkCompRlPsnVO> rlTypCdByVOMap = new HashMap<>();
        if(CollectionUtils.isNotEmpty(rlRsnTypList)){
        	for (KeyValueVO keyValueVO : rlRsnTypList) {
        		if (CollectionUtils.isNotEmpty(mustAddRlPsns) && mustAddRlPsns.contains(keyValueVO.getKey()) || CollectionUtils.isEmpty(mustAddRlPsns)) {
		        	PrjLnkCompRlPsnVO rlPsnVO = new PrjLnkCompRlPsnVO();
		        	rlPsnVO.setRlTypCd(keyValueVO.getKey());
		        	rlPsnVO.setRlTypCdNm(keyValueVO.getValue());
		        	rlPsnVO.setCertTypCd(SplInfoConstant.CODE_CERT_TYP_DEF_CD);
		        	rlPsnVO.setCertTypCdNm(defCodNm);
		        	rlPsnVO.setIsDel(BaseConstant.IS_YESNO_NO);
		        	rlPsnVO.setIsDefault(BaseConstant.IS_YESNO_YES);
		        	rlTypCdByVOMap.put(keyValueVO.getKey(), rlPsnVO);
        		}
        	}
        }
		for (PrjLnkCompRlPsnVO rlPsn : resultList) {
			if (rlTypCdByVOMap.containsKey(rlPsn.getRlTypCd())) {
				rlTypCdByVOMap.remove(rlPsn.getRlTypCd());
            }
		}
		if(CollectionUtils.isMapNotEmpty(rlTypCdByVOMap)){
        	for (Entry<String, PrjLnkCompRlPsnVO> entry : rlTypCdByVOMap.entrySet()) {
        		resultList.add(entry.getValue());
			}
        }

		// 设置联系人类型及证件类型
		this.setPrdSplRlPsnDTOWithDicInfo(resultList);
		BaseLogUtils.newWebLogger("处理挂靠公司联系人完成").setLogOperType(LogOperEnum.RESP)
				.setSysCd(CurrentThreadContext.getCurrentSysCd())
				.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
				.setBussinessId(BusinessIdConstant.LOG_SQOT_MANAGER_CD)
				.setWarning(false)
				.setKeys("resultList", JSON.toJSONString(resultList))
				.info();
		this.setRlPsnVerifyCode(resultList,lnkCompModDtlVOs);
		return resultList ;
	}

	private void setRlPsnVerifyCode(List<PrjLnkCompRlPsnVO> volist,List<LnkCompModDtlDTO> modDtlDTOs){
        BaseLogUtils.newWebLogger("设置初始化三要素信息").setLogOperType(LogOperEnum.RESP)
                .setSysCd(CurrentThreadContext.getCurrentSysCd())
                .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                .setBussinessId(BusinessIdConstant.LOG_SQOT_MANAGER_CD)
                .setWarning(false)
                .info();
		if(CollectionUtils.isNotEmpty(modDtlDTOs)) {
			List<Long> ids = new ArrayList<>();
			Map<Long, Map<String, String>> rlPsnIdByVerifyCdMap = new HashMap<>();
			for (LnkCompModDtlDTO dto : modDtlDTOs) {
				ids.add(dto.getModBusId());
				Map<String, String> attrConByAttrValue = rlPsnIdByVerifyCdMap.get(dto.getModBusId());
				if (CollectionUtils.isMapNotEmpty(attrConByAttrValue)) {
					attrConByAttrValue.put(dto.getModAttrFiled(), dto.getModConAft());
				} else {
					attrConByAttrValue = new HashMap<>();
					attrConByAttrValue.put(dto.getModAttrFiled(), dto.getModConAft());
				}
                rlPsnIdByVerifyCdMap.put(dto.getModBusId(),attrConByAttrValue);
			}
            BaseLogUtils.newWebLogger("设置初始化三要素信息").setLogOperType(LogOperEnum.RESP)
                    .setSysCd(CurrentThreadContext.getCurrentSysCd())
                    .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                    .setBussinessId(BusinessIdConstant.LOG_SQOT_MANAGER_CD)
                    .setWarning(false)
                    .setKeys("rlPsnIdByVerifyCdMap",JSON.toJSONString(rlPsnIdByVerifyCdMap),"ids",JSON.toJSONString(ids))
                    .info();
			for (PrjLnkCompRlPsnVO vo:volist) {
				if(ids.contains(vo.getId())){
					Map<String,String> attrConByAttrValue = rlPsnIdByVerifyCdMap.get(vo.getId());
					if(CollectionUtils.isMapNotEmpty(attrConByAttrValue)){
						if(StringUtils.isNotEmpty(attrConByAttrValue.get("busInfoVerify"))){
							vo.setBusInfoVerify(attrConByAttrValue.get("busInfoVerify"));
						}else{
							vo.setBusInfoVerify("2");
						}
						if(StringUtils.isNotEmpty(attrConByAttrValue.get("tdPerVerify"))){
							vo.setTdPerVerify(attrConByAttrValue.get("tdPerVerify"));
						}else{
							vo.setTdPerVerify("2");
						}
						if(StringUtils.isNotEmpty(attrConByAttrValue.get("pyPerVerify"))){
							vo.setPyPerVerify(attrConByAttrValue.get("pyPerVerify"));
						}else{
							vo.setPyPerVerify("2");
						}
						if(StringUtils.isNotEmpty(attrConByAttrValue.get("brPerVerify"))){
							vo.setBrPerVerify(attrConByAttrValue.get("brPerVerify"));
						}else{
							vo.setBrPerVerify("2");
						}
					}
				}
			}
		}

	}
	 /**
     * 设置主要人员基本信息中关于字典项信息
     *
     * @param listVo
     */
    private void setPrdSplRlPsnDTOWithDicInfo(List<PrjLnkCompRlPsnVO> listVo) {
        if (CollectionUtils.isNotEmpty(listVo)) {
			List<KeyValueVO> certTypCdList = this.prjLnkCompService.getCertTypCdList();
			Map<String,String> certTypCdMap = new HashMap<>();
			for (KeyValueVO keyValueVO : certTypCdList) {
				certTypCdMap.put(keyValueVO.getKey(), keyValueVO.getValue());
			}
			List<KeyValueVO> prjLnkCompRlRsnTypList = this.prjLnkCompService.getPrjLnkCompRlRsnTypList();
			Map<String,String> rlTypeCdMap = new HashMap<>();
			for (KeyValueVO keyValueVO : prjLnkCompRlRsnTypList) {
				rlTypeCdMap.put(keyValueVO.getKey(), keyValueVO.getValue());
			}
			for (PrjLnkCompRlPsnVO vo : listVo) {
				//证件类型
				if (certTypCdMap.containsKey(vo.getCertTypCd())) {
					vo.setCertTypCdNm(certTypCdMap.get(vo.getCertTypCd()));
				}
				//人员类型
				if (rlTypeCdMap.containsKey(vo.getRlTypCd())) {
					vo.setRlTypCdNm(rlTypeCdMap.get(vo.getRlTypCd()));
				}
			}
		}
    }
    /**
	 * 发起挂靠工商变更流程
	 */
	@RequestMapping(value = "/addLnkCompApplyFlow.do", method = { RequestMethod.POST })
	@ResponseBody
    public Object addLnkCompApplyFlow(HttpServletRequest request, HttpServletResponse response) throws BaseException{
    	DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, "发起挂靠公司工商变更成功");
    	String lnkCompId = request.getParameter("lnkCompId");
    	if(StringUtils.isEmpty(lnkCompId)){
    		result.setSuccess(BaseConstant.IS_YESNO_NO);
    		result.setInfo("挂靠公司ID为空！");
    		return result ;
    	}
    	try{
    		SysFlowSHQueryCondition condition = new SysFlowSHQueryCondition();
    		condition.setAudStsCd(FlowConstant.FLOW_CHECK_STATE_PASS);
    		condition.setDataId(Long.valueOf(lnkCompId));
    		condition.setBusTyp(FlowConstant.FLOW_MODEL_TYP_LNK);
    		condition.setWordsInTheTable("LNK");
    		condition.setSysCd(CurrentThreadContext.getCurrentSysCd());
			List<SysFlowSHDTO> searchFlowSHDTOList = this.flowApiService.searchFlowSHDTOList(condition );
    		if(CollectionUtils.isEmpty(searchFlowSHDTOList)){
    			result.setInfo("挂靠公司未准入");
	    		result.setSuccess(BaseConstant.IS_YESNO_NO);
	    		return result ;
    		}
			boolean b1 = this.prjLnkCompService.checkLnkCompFLowStatus(Long.valueOf(lnkCompId),true);
			if(b1){
				result.setInfo("禁止二次变更");
	    		result.setSuccess(BaseConstant.IS_YESNO_NO);
	    		return result ;
			}
	    	List<PrjLnkCompRlPsnVO> lnkCompRlList = new ArrayList<>();
	    	//获取挂靠基础信息
	    	PrjLnkCompVO prjLnkCompVO = this.prjLnkCompService.selectById(Long.valueOf(lnkCompId));
	    	PrjLnkCompRlPsnQC qc = new PrjLnkCompRlPsnQC();
	    	qc.setIsDel(BaseConstant.IS_YESNO_NO);
	    	qc.setIsValid(BaseConstant.IS_YESNO_YES);
	    	qc.setPrjLnkCompId(Long.valueOf(lnkCompId));
	    	lnkCompRlList = this.prjLnkCompRlPsnService.selectList(qc );

			//HsjBasicDTO hsjBasicDTO = hsjQueryService.getCommInfoByNameAndType("1", prjLnkCompVO.getLnkCompNm());
			//查询配置
			SysCtrlCfgQueryCondition ctrlCondition = new SysCtrlCfgQueryCondition();
			ctrlCondition.setCtrlCode(SplSystemConstant.MANUAL_GS_APPLY_SEARCH_HSJ_INTERVAL);
			ctrlCondition.setSysCd(SplSystemConstant.SPL_SYS_CD);
			ctrlCondition.setOrgCd(SplSystemConstant.DEFAULT_ORG_CD);
			String ctrlCode = this.sysCtrlCfgService.searchSysCtrlCfgByCtrlCode(ctrlCondition);
			long interval ;
			if (StringUtils.isEmpty(ctrlCode)) {
				interval = SplSystemConstant.MILLIS_FOR_24_HOURS;
			} else {
				interval = Long.parseLong(ctrlCode);
			}
			Date beforeInterval = new Date(new Date().getTime() - interval);
			HsjBasicDTO hsjBasicDTO = hsjQueryService.getCommInfoByNameAndTypeOnTime("1", prjLnkCompVO.getLnkCompNm(), beforeInterval, "MANUAL");

			if(hsjBasicDTO != null){
				List<String> rlTypCdList = new ArrayList<>();
				if(CollectionUtils.isNotEmpty(lnkCompRlList)){
					for (PrjLnkCompRlPsnVO prjLnkCompRlPsnVO : lnkCompRlList) {
						rlTypCdList.add(prjLnkCompRlPsnVO.getRlTypCd());
					}
				}
				if(CollectionUtils.isNotEmpty(lnkCompRlList) && rlTypCdList.contains("2")){
					for (PrjLnkCompRlPsnVO prjLnkCompRlPsnVO : lnkCompRlList) {
						if("2".equals(prjLnkCompRlPsnVO.getRlTypCd()) && StringUtils.isNotEmpty(hsjBasicDTO.getFrName())){
							if(!hsjBasicDTO.getFrName().equals(prjLnkCompRlPsnVO.getRlNm())){
								prjLnkCompRlPsnVO.setRlNm(hsjBasicDTO.getFrName());
								prjLnkCompRlPsnVO.setTel(null);
								prjLnkCompRlPsnVO.setCertNo(null);
								break ;
							}
						}
					}
				}else if(StringUtils.isNotEmpty(hsjBasicDTO.getFrName())){
					PrjLnkCompRlPsnVO rlPsnVO = new PrjLnkCompRlPsnVO() ;
					rlPsnVO.setRlNm(hsjBasicDTO.getFrName());
					rlPsnVO.setRlTypCd("2");
					rlPsnVO.setCertTypCd("0");
					lnkCompRlList.add(rlPsnVO);
				}
				prjLnkCompVO.setLnkCompNm(hsjBasicDTO.getEntName());
				prjLnkCompVO.setSucc(hsjBasicDTO.getCreditCode());
				prjLnkCompVO.setRlPsnList(lnkCompRlList);

				//封装变更主表信息
				LnkCompModDTO lnkCompModDTO = new LnkCompModDTO();
				lnkCompModDTO.setIsFileMdf(BaseConstant.IS_YESNO_NO);
				lnkCompModDTO.setIsBscMdf(BaseConstant.IS_YESNO_YES);
				lnkCompModDTO.setIsRlPsnMdf(BaseConstant.IS_YESNO_NO);
				lnkCompModDTO.setAudStsCd(FlowConstant.FLOW_CHECK_STATE_IN);
				lnkCompModDTO.setCrtTm(new Date());
				lnkCompModDTO.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
				lnkCompModDTO.setCrtUsrName(CurrentThreadContext.getCurrentUserName());
				lnkCompModDTO.setIsDel(BaseConstant.IS_YESNO_NO);
				lnkCompModDTO.setIsNew(BaseConstant.IS_YESNO_YES);
				lnkCompModDTO.setIsValid(BaseConstant.IS_YESNO_YES);
				lnkCompModDTO.setLnkCompId(Long.valueOf(lnkCompId));
				lnkCompModDTO.setFlowStatus(BaseConstant.IS_YESNO_YES);
				lnkCompModDTO.setFlowTyp(BaseConstant.IS_YESNO_YES);
				lnkCompModDTO.setTabNm(LnkCompConstant.LNK_COMP_FLOW_S_H_LNK_TAB);

				boolean b2 = this.prjLnkCompApplyService.checkFlowStatus(Long.valueOf(lnkCompId), CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd());
				boolean b = this.prjLnkCompService.checkLnkCompFLowStatus(Long.valueOf(lnkCompId),false);
				Long applyId = this.lnkCompModService.addLnkCompMod(lnkCompModDTO, PrjLnkCompVOTransform.toDTO(prjLnkCompVO), CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd());
				if(StringUtils.isEmpty(applyId)){
					result.setSuccess(BaseConstant.IS_YESNO_NO);
					result.setInfo(SysLogConstant.LOG_CMM_UPDATE_FAIL);
					BaseLogUtils.newWebLogger("修改挂靠公司信息失败!").setLogOperType(LogOperEnum.RESP)
							.setSysCd(CurrentThreadContext.getCurrentSysCd())
							.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
							.setBussinessId(BusinessIdConstant.LOG_SQOT_MANAGER_CD)
							.setWarning(false)
							.warn(LogExceptionEnum.COMMON_CODE_0002);
					return result;
				}else if(applyId == 0){
					result.setInfo("挂靠公司信息与三方信息一致！");
					return result ;
				}
				if(b || b2){
					LnkCompModVO lnkCompModVO = new LnkCompModVO();
					lnkCompModVO.setId(Long.valueOf(applyId));
					lnkCompModVO.setFlowStatus(BaseConstant.IS_YESNO_NO);
					lnkCompModVO.setMdfTm(new Date());
					lnkCompModVO.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
					this.lnkCompModService.modify(lnkCompModVO);
					result.setInfo("当前挂靠公司已存在变更流程！");
					result.setSuccess(BaseConstant.IS_YESNO_NO);
				}else{
					// 发起挂靠公司工商变更流程
					FlowStartedDTO flowStartedDTO = this.addLnkCompChangeFlowStart(request,applyId,Long.valueOf(lnkCompId));
					if(flowStartedDTO!= null && StringUtils.isNotBlank(flowStartedDTO.getNextOperUsrNames())){
						result.setInfo("下一个节点操作人:"+flowStartedDTO.getNextOperUsrNames());
					}else{
						result.setInfo("流程发起成功");
					}
				}
			}else{
				result.setInfo("未查询到工商信息！");
			}
    	}catch(BaseException be){
    		result.setInfo(be.getMessage());
    		result.setSuccess(BaseConstant.IS_YESNO_NO);
			BaseLogUtils.newWebLogger("发起工商变更流程失败,业务异常").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SQOT_MANAGER_CD)
					.setWarning(false)
					.setThrowable(be)
					.warn(LogExceptionEnum.COMMON_CODE_0001);
    	}catch(Exception ex){
    		result.setInfo(ex.getMessage());
    		result.setSuccess(BaseConstant.IS_YESNO_NO);
			BaseLogUtils.newWebLogger("发起工商变更流程失败,系统异常").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SQOT_MANAGER_CD)
					.setWarning(false)
					.setThrowable(ex)
					.error(LogExceptionEnum.COMMON_CODE_0099);
    	}
    	return result ;
    }
	 /**
		 * 发起挂靠工商变更流程
		 */
		@RequestMapping(value = "/againAddLnkCompApplyFlow.do", method = { RequestMethod.POST })
		@ResponseBody
	    public Object againAddLnkCompApplyFlow(HttpServletRequest request, HttpServletResponse response) throws BaseException{
			String lnkId = request.getParameter("lnkId");
			String applyId = request.getParameter("applyId");

			DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,"发起挂靠公司工商变更流程成功！");
			if(StringUtils.isEmpty(applyId)){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo("挂靠公司变更主表ID为空，发起失败！");
				return result ;
			}
			try{
				// 当前挂靠公司是否在变更中
				boolean b = this.prjLnkCompService.checkLnkCompFLowStatus(Long.valueOf(lnkId),false);
		    	if(b){
					BaseLogUtils.newWebLogger("当前挂靠公司在变更中，不发起工商变更流程!").setLogOperType(LogOperEnum.RESP)
							.setSysCd(CurrentThreadContext.getCurrentSysCd())
							.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
							.setBussinessId(BusinessIdConstant.LOG_SQOT_MANAGER_CD)
							.setWarning(false)
							.warn(LogExceptionEnum.COMMON_CODE_0002);
					result.setInfo("当前挂靠公司在变更中，不发起工商变更流程！");
					return result;
		    	}
				FlowStartedDTO addLnkGsApplyFlowStart = this.addLnkCompChangeFlowStart(request,Long.valueOf(applyId), Long.valueOf(lnkId));

				if(addLnkGsApplyFlowStart != null){
					//SplBscInfoApplyVO entity = new SplBscInfoApplyVO();
					//entity.setId(Long.valueOf(applyId));
					//entity.setFlowStatus(BaseConstant.IS_YESNO_YES);
					//this.splBscInfoApplyService.saveBscInfoApply(entity);
					LnkCompModVO lnkCompModVO = new LnkCompModVO();
					lnkCompModVO.setId(Long.valueOf(applyId));
					lnkCompModVO.setFlowStatus(BaseConstant.IS_YESNO_YES);
					lnkCompModVO.setMdfTm(new Date());
					lnkCompModVO.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
					this.lnkCompModService.modify(lnkCompModVO);
					result.setInfo("流程发起成功！");
					result.setSuccess(BaseConstant.IS_YESNO_YES);
				}else{
					result.setInfo("流程发起失败！");
					result.setSuccess(BaseConstant.IS_YESNO_NO);
					}
			}catch(BaseException be){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo("重新发起工商变更流程失败！");
				BaseLogUtils.newWebLogger("再次发起工商变更流程失败,业务异常").setLogOperType(LogOperEnum.REQ)
						.setSysCd(CurrentThreadContext.getCurrentSysCd())
						.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
						.setBussinessId(BusinessIdConstant.LOG_SQOT_MANAGER_CD)
						.setWarning(false)
						.setThrowable(be)
						.warn(LogExceptionEnum.COMMON_CODE_0001);
			}catch(Exception ex){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo("重新发起工商变更流程失败！");
				BaseLogUtils.newWebLogger("再次发起工商变更流程失败,系统异常").setLogOperType(LogOperEnum.REQ)
						.setSysCd(CurrentThreadContext.getCurrentSysCd())
						.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
						.setBussinessId(BusinessIdConstant.LOG_SQOT_MANAGER_CD)
						.setWarning(false)
						.setThrowable(ex)
						.error(LogExceptionEnum.COMMON_CODE_0099);
			}
			return result ;
		}
	private FlowStartedDTO addLnkCompChangeFlowStart(HttpServletRequest request,Long applyId,Long lnkId){

		//String procDefKey = "FLOW_0000_039_002" ;//request.getParameter("procDefKey");
		//String procDefId = null ;//request.getParameter("procDefId");
		//String procNo = null ;//request.getParameter("procNo");
		FlowStartParamsDTO flowStartParamsDTO = new FlowStartParamsDTO();
		try {
			Map<Long, String> selectPrjOrgCdByDataId = this.splDataStatisticsApiService.selectPrjOrgCdByDataId(lnkId, "LNK");
			HashMap<String, Object> param = new HashMap<>();
        	param.put("isFlowType", BaseConstant.IS_YESNO_YES);
        	if(CollectionUtils.isMapNotEmpty(selectPrjOrgCdByDataId)){
        		Set<Long> keySet = selectPrjOrgCdByDataId.keySet();
				String orgCd = null ;
				Long cstMgrId = null ;
				for (Long long1 : keySet) {
					cstMgrId = long1 ;
					orgCd = selectPrjOrgCdByDataId.get(long1);
				}
				param.put("verifierId", cstMgrId);
        	}else{
        		param.put("verifierId", CurrentThreadContext.getCurrentUserId());
        	}
        	String ownerCd = request.getParameter("ownerCd");
        	if(StringUtils.isNotEmpty(ownerCd) && "2".equals(ownerCd)){
        		param.put("isOwnerCd", BaseConstant.IS_YESNO_NO);
        	}else{
        		param.put("isOwnerCd", BaseConstant.IS_YESNO_YES);
        	}
			SysFlowManageVQueryCondition qc = new SysFlowManageVQueryCondition();
			qc.setModelTyp("039");
			qc.setSysCd(SplSystemConstant.FL_SYS_CD);
			qc.setOrgCd(SplSystemConstant.DEFAULT_ORG_CD);
			//qc.setProcDefKey(WebBaseConstant.FLOW_DEF_KEY_LNK_GS_CHG);
	        List<SysFlowManageVVO> list = this.flowService.searchFlowManageVListForStart(qc);
			BaseLogUtils.newWebLogger("查询可发起的流程").setLogOperType(LogOperEnum.RESP)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SQOT_MANAGER_CD)
					.setWarning(false)
					.setKeys("sysFlowManageVVOList", JSON.toJSONString(list))
					.info();
	        if(CollectionUtils.isNotEmpty(list)){
	        	SysFlowManageVVO vvo = list.get(0);
				// 流程定义Key和流程定义ID 如果是前端选择的则直接指定,如果不是则系统自动按照配置选择唯一一条记录,如果找不到会提示
				flowStartParamsDTO.setAudStsCd(FlowConstant.FLOW_CHECK_STATE_IN);

				flowStartParamsDTO.setWordsInTheTable(PrjLnkCompRelInfoConstant.FLOW_S_H_LNK);
				// 流程定义标识(必填)
				flowStartParamsDTO.setProcDefKey(WebBaseConstant.FLOW_DEF_KEY_LNK_GS_CHG);
				// 流程定义ID(必填)
				flowStartParamsDTO.setProcDefId(vvo.getProcDefId());
				// 流程定义名称(自定义)
				flowStartParamsDTO.setProcNo(vvo.getProcNo());

				flowStartParamsDTO.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
				// 业务数据主键(必填)
				flowStartParamsDTO.setBusinessKey(applyId + "");
				flowStartParamsDTO.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
				flowStartParamsDTO.setBuOrgCd(CurrentThreadContext.getCurrentBuOrgCd());
				flowStartParamsDTO.setSysCd(CurrentThreadContext.getCurrentSysCd());
				flowStartParamsDTO.setInitiator(String.valueOf(CurrentThreadContext.getCurrentUserId()));
				flowStartParamsDTO.setInitiatorNm(CurrentThreadContext.getCurrentUserName());
				flowStartParamsDTO.setProcPriority(FlowConstant.FLOW_PRIORITY_EMERGENCY);// 优先级,可以在界面定义
				// 业务类型(必填)-用于区分操作表标识
				flowStartParamsDTO.setBusinessType(FlowConstant.FLOW_BUSINESS_TYP_LNK);// 确认用不用
				// 模块类型(流程业务分类): 针对直接启动流程的业务使用
				flowStartParamsDTO.setModelTyp(WebBaseConstant.FLOW_MODEL_TYP_LNK_GS_CHG);// 需要和流程配置中的模块类型匹配
				flowStartParamsDTO.setSearchDesc(CurrentThreadContext.getCurrentOrgDispNm() + "挂靠公司信息变更流程大字段参数未定!");
				flowStartParamsDTO.setStartParams(param);
				DataResultDTO dataResultDTO = this.flowApiService.noTransFlowStart(flowStartParamsDTO);
				if(null!=dataResultDTO && null!=dataResultDTO.getData()){
					FlowStartedDTO flowStartedDTO = (FlowStartedDTO) dataResultDTO.getData();
					return flowStartedDTO;
				}
	        }
		} catch (BaseException e) {
			LnkCompModVO lnkCompModVO = new LnkCompModVO();
			lnkCompModVO.setId(Long.valueOf(applyId));
			lnkCompModVO.setFlowStatus(BaseConstant.IS_YESNO_NO);
			lnkCompModVO.setMdfTm(new Date());
			lnkCompModVO.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
			this.lnkCompModService.modify(lnkCompModVO);
			BaseLogUtils.newWebLogger("发起挂靠工商变更失败,业务异常").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SQOT_MANAGER_CD)
					.setWarning(false)
					.setThrowable(e)
					.warn(LogExceptionEnum.COMMON_CODE_0001);
			e.getStackTrace();
		} catch (Exception e) {
			LnkCompModVO lnkCompModVO = new LnkCompModVO();
			lnkCompModVO.setId(Long.valueOf(applyId));
			lnkCompModVO.setFlowStatus(BaseConstant.IS_YESNO_NO);
			lnkCompModVO.setMdfTm(new Date());
			lnkCompModVO.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
			this.lnkCompModService.modify(lnkCompModVO);
			BaseLogUtils.newWebLogger("发起挂靠工商变更失败,系统异常").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SQOT_MANAGER_CD)
					.setWarning(false)
					.setThrowable(e)
					.error(LogExceptionEnum.COMMON_CODE_0099);
			e.getStackTrace();
		}
		return null;
	}



    /**
     * 获取挂靠变更流程资料信息
     *
     * @param fileParams
     * @return
     * @throws BaseException
     */
    private List<SysUlFilesRecVO> getFileList(String fileParams, Long modId,PrjLnkCompVO prjLnkComp) throws BaseException {
    	
    	List<String> cfgDtlCdList = new ArrayList<>();
		cfgDtlCdList.add("10");
		cfgDtlCdList.add("20");
		cfgDtlCdList.add("30");
		cfgDtlCdList.add("50");
		cfgDtlCdList.add("80");
		
        List<SysUlFilesRecVO> sysUlFilesRecVOList = new ArrayList<SysUlFilesRecVO>();
        //解析附件上传信息
        if (StringUtils.isNotEmpty(fileParams)) {
            List<Map<String, String>> fileParamsList = new ArrayList<Map<String, String>>();
            JSONArray arry = JSONArray.fromObject(fileParams);
            JSONArray arry2 = new JSONArray();
            for (int i = 0; i < arry.size(); i++) {
            	net.sf.json.JSONObject jsonObject = arry.getJSONObject(i);
            	if(jsonObject.get("id") == null){
            		arry2.add(jsonObject);
            	}
            }
            if (!(arry2.size() > 0)) {
                return null;
            }
            for (int i = 0; i < arry2.size(); i++) {
                net.sf.json.JSONObject jsonObject = arry2.getJSONObject(i);
                Iterator<?> it = jsonObject.keys();
                HashMap<String, String> hMap = new HashMap<String, String>();
                while (it.hasNext()) {
                    String key = String.valueOf(it.next());
                    String value = (String) jsonObject.get(key);
                    hMap.put(key, value);
                }
                fileParamsList.add(hMap);
            }
            for (Map<String, String> map : fileParamsList) {
            	SysUlFilesRecVO sysUlFilesRecVO = new SysUlFilesRecVO();
            	if(cfgDtlCdList.contains(map.get("cfgDtlCd"))){
					if (LnkCompFileCfgEnum.PRJ029.getCode().equals(map.get("cfgCd"))) {
						sysUlFilesRecVO.setAbsLocPath(PropertiesCacheUtils.getProperty(LnkCompFileCfgEnum.PRJ029.getUploadRootPath()) + map.get("filePath"));
					} else if (LnkCompFileCfgEnum.PRJ030.getCode().equals(map.get("cfgCd"))){
						sysUlFilesRecVO.setAbsLocPath(PropertiesCacheUtils.getProperty(LnkCompFileCfgEnum.PRJ030.getUploadRootPath()) + map.get("filePath"));
					} else {
						sysUlFilesRecVO.setAbsLocPath(PropertiesCacheUtils.getProperty(LnkCompFileCfgEnum.PRJ032.getUploadRootPath()) + map.get("filePath"));
					}
	                sysUlFilesRecVO.setPkId(modId + "");
	                sysUlFilesRecVO.setCfgCd(map.get("cfgCd"));
	                sysUlFilesRecVO.setTabNm(LnkCompConstant.LNK_COMP_MOD_FLOW_S_H_LNK_TAB);
            	}else{
            		if ("2".equals(map.get(prjLnkComp.getOwnerCd()))) {
            			sysUlFilesRecVO.setCfgCd(LnkCompFileCfgEnum.PRJ029.getCode());
            			sysUlFilesRecVO.setAbsLocPath(PropertiesCacheUtils.getProperty(LnkCompFileCfgEnum.PRJ029.getUploadRootPath()) + map.get("filePath"));
            		} else if ("1".equals(prjLnkComp.getOwnerCd())){
            			sysUlFilesRecVO.setCfgCd(LnkCompFileCfgEnum.PRJ030.getCode());
            			sysUlFilesRecVO.setAbsLocPath(PropertiesCacheUtils.getProperty(LnkCompFileCfgEnum.PRJ030.getUploadRootPath()) + map.get("filePath"));
            		} else {
            			sysUlFilesRecVO.setCfgCd(LnkCompFileCfgEnum.PRJ032.getCode());
            			sysUlFilesRecVO.setAbsLocPath(PropertiesCacheUtils.getProperty(LnkCompFileCfgEnum.PRJ032.getUploadRootPath()) + map.get("filePath"));
            		}
            		
            		sysUlFilesRecVO.setPkId(prjLnkComp.getId()+"");
            		sysUlFilesRecVO.setTabNm(LnkCompConstant.LNK_COMP_FLOW_S_H_LNK_TAB);
            		
            	}
            	sysUlFilesRecVO.setCrtTm(new Date());
            	sysUlFilesRecVO.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
            	sysUlFilesRecVO.setFileNm(map.get("fileNm"));
            	sysUlFilesRecVO.setFilePath(map.get("filePath"));
            	sysUlFilesRecVO.setSysCd(map.get("sysCd"));
            	sysUlFilesRecVO.setOrgCd(map.get("orgCd"));
            	sysUlFilesRecVO.setCfgDtlCd(map.get("cfgDtlCd"));
            	//默认验证状态:未验证
            	sysUlFilesRecVO.setAudStsCd(PropertiesCacheUtils.getProperty(fl.constant.facade.framework.constant.DictionaryConstant.CODE_GRP_VALID_STATUS_CD_A));
            	sysUlFilesRecVO.setIsDel(BaseConstant.IS_YESNO_NO);
            	sysUlFilesRecVOList.add(sysUlFilesRecVO);
            }
        } else {
            throw new BaseException(BaseExceptionConstant.COMMON_0001, "保存挂靠变更流程资料信息,没有要保存的资料.");
        }
        return sysUlFilesRecVOList;
    }

    /**
	 * 校验附件是否改变
	 */
	@RequestMapping(value = "/checkFileIsChange.do", method = { RequestMethod.POST })
	@ResponseBody
    public Object checkFileIsChange(HttpServletRequest request, HttpServletResponse response) throws BaseException{
		String fileParams = request.getParameter("fileParams");
		String removeFilesIds = request.getParameter("removeFileIds");
		List<String> cfgDtlCdList = new ArrayList<>();
		cfgDtlCdList.add("10");
		cfgDtlCdList.add("20");
		cfgDtlCdList.add("30");
		cfgDtlCdList.add("50");
		cfgDtlCdList.add("80");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_UPDATE_SUCC);
		if (StringUtils.isNotEmpty(fileParams)) {
			List<PrjFileInfoVO> fileParamList = JSON.parseArray(fileParams, PrjFileInfoVO.class);
			for (PrjFileInfoVO prjFileInfoVO : fileParamList) {
				if(StringUtils.isEmpty(prjFileInfoVO.getFileId()) && cfgDtlCdList.contains(prjFileInfoVO.getCfgDtlCd())){
					result.setInfo("1");
				}
			}
		}
		if(StringUtils.isNotEmpty(removeFilesIds)){
			result.setInfo("1");
		}
		return result;
    }
	/**
	 * 变更记录
	 */
	@RequestMapping(value = "/initChangeList.do", method = { RequestMethod.POST,RequestMethod.GET })
	@ResponseBody
    public Object initChangeList(HttpServletRequest request, HttpServletResponse response) throws BaseException{
		String lnkCompId = request.getParameter("lnkCompId");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_UPDATE_SUCC);
		if(StringUtils.isEmpty(lnkCompId)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("挂靠公司ID不能为空！");
			return result ;
		}
		Map<String, String> suppPrjTypMap = this.sysDictionaryApiService.searchGroupToMap(SplSystemConstant.SPL_SYS_CD,
				SplSystemConstant.DEFAULT_ORG_CD, PrjLnkCompRelInfoConstant.SUPP_LNK_PRJ_TYP_DIC_CODE);

		List<JSONObject> searchChangeList = this.lnkCompModService.searchChangeList(Long.valueOf(lnkCompId));

		if(CollectionUtils.isNotEmpty(searchChangeList)){
			for (JSONObject jsonObject : searchChangeList) {
				StringBuffer sb ;
				if(null !=jsonObject.get("befSuppPrjTypCd")){
					sb = new StringBuffer();
					String befSuppPrjTypCd = (String) jsonObject.get("befSuppPrjTypCd");
					String[] split = befSuppPrjTypCd.split(";");
					for (String string : split) {
						sb.append(suppPrjTypMap.get(string));
						sb.append(",");
					}
					jsonObject.put("befSuppPrjTypCdNm", sb.substring(0,sb.length()-1).toString());
				}
				if(null !=jsonObject.get("aftSuppPrjTypCd")){
					sb = new StringBuffer();
					String aftSuppPrjTypCd = (String) jsonObject.get("aftSuppPrjTypCd");
					String[] split = aftSuppPrjTypCd.split(";");
					for (String string : split) {
						sb.append(suppPrjTypMap.get(string));
						sb.append(",");
					}
					jsonObject.put("aftSuppPrjTypCdNm", sb.substring(0,sb.length()-1).toString());
				}
			}
		}
		result.setData(searchChangeList);
		return result;
    }

	private ModelAndView oldToProcessPage(HttpServletRequest request) throws BaseException{
		try {
			BaseLogUtils.newWebLogger("获取挂靠公司变更主表数据详情，请求参数").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SQOT_MANAGER_CD)
					.setWarning(false)
					.setKeys("request", super.getRequestParameter(request))
					.info();
			String lnkCompNm = request.getParameter("lnkCompNm");// 公司名称
			String orgCode = request.getParameter("orgCode");// 组织机构代码
			String bizLicNo = request.getParameter("bizLicNo");// 营业执照注册号
			String taxRegNo = request.getParameter("taxRegNo");// 税务登记号
			String audStsCd = request.getParameter("audStsCd");
			String isFlow = request.getParameter("isFlow");
			String BuOrgCd = CurrentThreadContext.getCurrentBuOrgCd();
			String applyId = request.getParameter("applyId");// 变更公司id
			String flag = request.getParameter("audStsCd"); // 前台标识 0
															// 审批人流程审批页面，1呈报人驳回页面
			String succ = request.getParameter("succ"); //统一社会信用代码

			PrjLnkCompApplyVO compApplyVO = this.prjLnkCompApplyService.selectById(Long.valueOf(applyId));

			if(compApplyVO.getExpDtB() != null){
				compApplyVO.setExpDtBStr(DateUtils.formatDateToString(compApplyVO.getExpDtB(),DateUtils.YYYY_MM_DD));
			}
			if(compApplyVO.getExpDt() != null){
				compApplyVO.setExpDtStr(DateUtils.formatDateToString(compApplyVO.getExpDt(),DateUtils.YYYY_MM_DD));
			}

			Long id = compApplyVO.getPrjLnkCompId();
			PrjLnkCompRlPsnQC pqc = new PrjLnkCompRlPsnQC();
			pqc.setPrjLnkCompId(id);
			ModelAndView view = null;
			PrjLcApplyRlPsnQueryCondition qc = new PrjLcApplyRlPsnQueryCondition();
			qc.setPrjLnkCompApplyId(Long.valueOf(applyId));
			// 关联人员变更表更信息
			List<PrjLcApplyRlPsnVO> searchList = this.prjLcApplyRlPsnService.searchList(qc);
			//关系人员表信息
			List<PrjLnkCompRlPsnVO> prjLnkCompRlPsn = this.prjLnkCompRlPsnService.selectList(pqc);
			//整和两张表中的数据集合
			List<PrjLcApplyRlPsnVO> totalList = new ArrayList<>();

			for (PrjLcApplyRlPsnVO vo1 : searchList) {
				if (vo1.getIsDefault() != null && vo1.getIsDefault() == 1) {
					totalList.add(vo1);
				}
			}
				for(PrjLnkCompRlPsnVO vo2 : prjLnkCompRlPsn){
					PrjLcApplyRlPsnVO prjLcApplyRlPsnVO = new PrjLcApplyRlPsnVO();
					if(vo2.getIsDefault() == null && vo2.getIsDel() == 0){
						prjLcApplyRlPsnVO.setRlTypCd(vo2.getRlTypCd());
						prjLcApplyRlPsnVO.setRlNm(vo2.getRlNm());
						prjLcApplyRlPsnVO.setCertTypCd(vo2.getCertTypCd());
						prjLcApplyRlPsnVO.setCertNo(vo2.getCertNo());
						prjLcApplyRlPsnVO.setTel(vo2.getTel());
						prjLcApplyRlPsnVO.setRlRem(vo2.getRlRem());
						prjLcApplyRlPsnVO.setIsDel(vo2.getIsDefault());
						totalList.add(prjLcApplyRlPsnVO);
					}
				}
			//if (Integer.valueOf(flag) == 0) {
				view = new ModelAndView("project/prjLnkCompApply/prjlnkApplyProcess");
			//} else if (Integer.valueOf(flag) == 1) {
				//view = new ModelAndView("project/prjLnkCompApply/prjlnkApplyProcesstoReport");
			//}

			// 挂靠公司关联人员类型
			List<KeyValueVO> prjLnkCompRlRsnTypList = prjLnkCompService.getPrjLnkCompRlRsnTypList();
			// 获取证件类型
			List<KeyValueVO> certTypCdList = prjLnkCompService.getCertTypCdList();
			view.addObject("certTypCdList", JSON.toJSONString(certTypCdList));
			view.addObject("rlRsnTypListJSON", JSON.toJSONString(prjLnkCompRlRsnTypList));

			//必填联系人类型
			List<SysDictionaryDTO> mustAddRlPsnTypCds = this.sysDictionaryApiService.searchGroupAll(CurrentThreadContext.getCurrentSysCd(),CurrentThreadContext.getCurrentOrgCd(),DictionaryConstant.CODE__PRJ_LNK_COMP_RL_PSN_TYP_CD);
			List<String> mustAddRlPsns = null ;
			if(CollectionUtils.isNotEmpty(mustAddRlPsnTypCds)){
				mustAddRlPsns = new ArrayList<>(mustAddRlPsnTypCds.size());
				for(SysDictionaryDTO dto : mustAddRlPsnTypCds){
					if(BaseConstant.IS_YESNO_NO == dto.getIsSysDef()){
						continue;
					}
					mustAddRlPsns.add(dto.getCode());
				}
			}
			view.addObject("mustAddRlPsnTypCdJSON", null == mustAddRlPsns ? null :JSON.toJSON(mustAddRlPsns));

			PrjLnkCompVO prjLnkCompVO = null;
			String defCodNm = "";
			for (KeyValueVO keyValueVO : certTypCdList) {
				if (keyValueVO.getKey().equals(PrjLnkCompRelInfoConstant.CODE_CERT_TYP_DEF_CD)) {
					defCodNm = keyValueVO.getValue();
				}
			}

			List<KeyValueVO> keyValueList = prjLnkCompService.getOwnerCdList();
			// 联系人类型和证件类型赋值
			for (PrjLcApplyRlPsnVO vo : totalList) {
				for (int i = 0; i < certTypCdList.size(); i++) {
					KeyValueVO kv = certTypCdList.get(i);
					if (StringUtils.isNotEmpty(vo.getIsDefault()) && 1 == vo.getIsDefault()) {
						if (vo.getCertTypCd().equals(kv.getKey()) && vo.getCertTypCd() != null
								&& vo.getCertTypCd() != "") {
							vo.setCertTypCdNm(kv.getValue());
						}
					}
				}
				for (int i = 0; i < prjLnkCompRlRsnTypList.size(); i++) {
					KeyValueVO kv = prjLnkCompRlRsnTypList.get(i);
					if (StringUtils.isNotEmpty(vo.getIsDefault()) && 1 == vo.getIsDefault()) {
						if (vo.getRlTypCd().equals(kv.getKey()) && vo.getRlTypCd() != null && vo.getRlTypCd() != "") {
							vo.setRlTypCdNm(kv.getValue());
						}
					}
				}
			}
			ListPageVO<PrjLcApplyRlPsnVO> prjLclistPage = new ListPageVO<PrjLcApplyRlPsnVO>(totalList, totalList.size());
			// id 存在时为修改
			if (StringUtils.isNotEmpty(id)) {
				// 获取保存的联系人信息
				prjLnkCompVO = this.prjLnkCompService.selectPrjLnkCompByIdAndBuOrgCd(id);

				if(prjLnkCompVO.getExpDt() != null){
					prjLnkCompVO.setExpDtStr(DateUtils.formatDateToString(prjLnkCompVO.getExpDt(),DateUtils.YYYY_MM_DD));
				}

				if(prjLnkCompVO.getRegDt() != null){
					prjLnkCompVO.setRegDtStr(DateUtils.formatDateToString(prjLnkCompVO.getRegDt(),DateUtils.YYYY_MM_DD));
				}

			} else {
				prjLnkCompVO = new PrjLnkCompVO();
				prjLnkCompVO.setLnkCompNm(lnkCompNm);
				prjLnkCompVO.setOrgCode(orgCode);
				prjLnkCompVO.setBizLicNo(bizLicNo);
				prjLnkCompVO.setTaxRegNo(taxRegNo);
				prjLnkCompVO.setSucc(succ);
			}
			prjLnkCompVO.setLnkCompNm(compApplyVO.getLnkCompNm());
			prjLnkCompVO.setSucc(compApplyVO.getSucc());
			prjLnkCompVO.setExpDtStr(compApplyVO.getExpDtStr());
			prjLnkCompVO.setExpDt(compApplyVO.getExpDt());

			// 可支持挂靠项目类型所有集合--PRJ0148
			// 可支持挂靠项目类型默认集合
			List<SysDictionaryDTO> prjTypCdList = this.sysDictionaryApiService.searchGroup(SplSystemConstant.SPL_SYS_CD,
					SplSystemConstant.DEFAULT_ORG_CD, PrjLnkCompRelInfoConstant.SUPP_LNK_PRJ_TYP_DIC_CODE);
			if (CollectionUtils.isNotEmpty(prjTypCdList)) {
				List<KeyValueVO> allSuppLnkPrjTypCdList = new ArrayList<>(prjTypCdList.size());
				StringBuilder defaultSuppLnkPrjTypCdString = null;
				KeyValueVO keyValueVO ;
				for (SysDictionaryDTO dto : prjTypCdList) {
					keyValueVO = new KeyValueVO();
					keyValueVO.setKey(dto.getCode());
					keyValueVO.setValue(dto.getCodeNm());
					allSuppLnkPrjTypCdList.add(keyValueVO);
					if (dto.getIsSysDef() == BaseConstant.IS_YESNO_YES) {
						if (null == defaultSuppLnkPrjTypCdString) {
							defaultSuppLnkPrjTypCdString = new StringBuilder();
							defaultSuppLnkPrjTypCdString.append(dto.getCode());
						} else {
							defaultSuppLnkPrjTypCdString.append(";").append(dto.getCode());
						}
					}
				}
				view.addObject("suppLnkPrjTypCdListJson", JSONArray.fromObject(allSuppLnkPrjTypCdList.toArray()));
			}

			String taskNm = request.getParameter("taskNm");
			if(StringUtils.isNotEmpty(taskNm) && "信审中心审核".equals(taskNm)){
				view.addObject("isCheckVerify", 1);
			}else{
				view.addObject("isCheckVerify", 0);
			}

			view.addObject("tabNm1", LnkCompFileCfgEnum.PRJ030.getTableNm());
			view.addObject("cfgCd1", LnkCompFileCfgEnum.PRJ030.getCode());
			view.addObject("cfgOrgCd1", LnkCompFileCfgEnum.PRJ030.getOrgCd());
			view.addObject("cfgSysCd1", LnkCompFileCfgEnum.PRJ030.getSysCd());
			view.addObject("modulePath1", LnkCompFileCfgEnum.PRJ030.getModulePath());
			view.addObject("costomerPath1", LnkCompFileCfgEnum.PRJ030.getUploadCostomerPath());
			view.addObject("rootPath1", LnkCompFileCfgEnum.PRJ030.getUploadRootPath());
			view.addObject("uploadSysCd1", LnkCompFileCfgEnum.PRJ030.getUploadSysCd());
			view.addObject("tabNm2", LnkCompFileCfgEnum.PRJ029.getTableNm());
			view.addObject("cfgCd2", LnkCompFileCfgEnum.PRJ029.getCode());
			view.addObject("cfgOrgCd2", LnkCompFileCfgEnum.PRJ029.getOrgCd());
			view.addObject("cfgSysCd2", LnkCompFileCfgEnum.PRJ029.getSysCd());
			view.addObject("modulePath2", LnkCompFileCfgEnum.PRJ029.getModulePath());
			view.addObject("costomerPath2", LnkCompFileCfgEnum.PRJ029.getUploadCostomerPath());
			view.addObject("rootPath2", LnkCompFileCfgEnum.PRJ029.getUploadRootPath());
			view.addObject("uploadSysCd2", LnkCompFileCfgEnum.PRJ029.getUploadSysCd());
			view.addObject("tabNm3", LnkCompFileCfgEnum.PRJ032.getTableNm());
			view.addObject("cfgCd3", LnkCompFileCfgEnum.PRJ032.getCode());
			view.addObject("cfgOrgCd3", LnkCompFileCfgEnum.PRJ032.getOrgCd());
			view.addObject("cfgSysCd3", LnkCompFileCfgEnum.PRJ032.getSysCd());
			view.addObject("modulePath3", LnkCompFileCfgEnum.PRJ032.getModulePath());
			view.addObject("costomerPath3", LnkCompFileCfgEnum.PRJ032.getUploadCostomerPath());
			view.addObject("rootPath3", LnkCompFileCfgEnum.PRJ032.getUploadRootPath());
			view.addObject("uploadSysCd3", LnkCompFileCfgEnum.PRJ032.getUploadSysCd());

            SysUlDatCfgQueryCondition ulDatCfgQueryCondition = new SysUlDatCfgQueryCondition();
            ulDatCfgQueryCondition.setSysCd(LnkCompFileCfgEnum.PRJ029.getSysCd());//系统代码
            ulDatCfgQueryCondition.setOrgCd(LnkCompFileCfgEnum.PRJ029.getOrgCd());
            ulDatCfgQueryCondition.setIsValid(BaseConstant.IS_YESNO_YES);
            ulDatCfgQueryCondition.setIsDel(BaseConstant.IS_YESNO_NO);
            List<String> cfgCdList = new ArrayList<>();
            cfgCdList.add(LnkCompFileCfgEnum.PRJ029.getCode());//配置编号
            cfgCdList.add(LnkCompFileCfgEnum.PRJ030.getCode());
            cfgCdList.add(LnkCompFileCfgEnum.PRJ032.getCode());
            ulDatCfgQueryCondition.setCfgCdList(cfgCdList);//配置编号集合
            List<SysUlDatCfgDTO> allCfgCdList = this.uploadApiService.searchSysUlDatCfgList(ulDatCfgQueryCondition);
            if (CollectionUtils.isNotEmpty(allCfgCdList)) {
                List<SysUlDatCfgDtlDTO> allCfgDtlCdList = new ArrayList<>();
                for (SysUlDatCfgDTO dto : allCfgCdList) {
                    allCfgDtlCdList.addAll(dto.getSysUlDatCfgDtlDTOList());
                }
                view.addObject("allCfgDtlCdList", JSON.toJSONString(allCfgDtlCdList));
            }

			view.addObject("rlPsnList", JSON.toJSONString(prjLclistPage));// 挂靠公司变更申请关联人员信息
			view.addObject("keyValueList", keyValueList);
			view.addObject("lnkCompId", id);
			view.addObject("BuOrgCd", BuOrgCd);
			view.addObject("prjLnkComp", prjLnkCompVO);
			//view.addObject("compApplyVO", compApplyVO); // 变更关联人员信息
			view.addObject("rlRsnTypList", JSON.toJSONString(prjLnkCompVO.getRlPsnList()));
			view.addObject("audStsCd", audStsCd);
			view.addObject("isFlow", isFlow);
			view.addObject("applyId", applyId);
			BaseLogUtils.newWebLogger("跳转到修改挂靠公司页面").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SQOT_MANAGER_CD)
					.setWarning(false)
					.info();
			return view;
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;

	}

	private DataResultVO oldAdd(HttpServletRequest request) throws BaseException{

		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_ADD_SUCC);
		Long id = null;
		PrjLnkCompVO prjLnkCompVO = null; // 挂靠公司
		PrjLnkCompApplyVO prjLnkCompApplyVO = null; // 挂靠公司变更
		String applyId = request.getParameter("applyId"); // 挂靠公司变更id
		String lnkCompId = request.getParameter("lnkCompId");// 挂靠公司ID
		try {
			prjLnkCompVO = getPrjLnkCompParam(request); // 获取页面参数
			// 挂靠公司原数据
			PrjLnkCompVO prjLnkComp = this.prjLnkCompService.selectById(Long.valueOf(lnkCompId));
			// 关联人员原数据
			PrjLnkCompRlPsnQC rlqc = new PrjLnkCompRlPsnQC();
			rlqc.setPrjLnkCompId(Long.valueOf(lnkCompId));
			//by lgj 20180319
			//rlqc.setIsDefault(1);
			List<PrjLnkCompRlPsnVO> preList = this.prjLnkCompRlPsnService.selectList(rlqc);
			// 关联人员变更数据
			String list = request.getParameter("rlPsnList");
			List<PrjLnkCompRlPsnVO> bakList = JSON.parseArray(list, PrjLnkCompRlPsnVO.class);

			// 挂靠公司变更id如有修改否则添加
			//驳回修改保持时先删除不是默认值的关系人员
			boolean prjLnkCompRemoveId = false;
			for(PrjLnkCompRlPsnVO pvo : preList){
				if (pvo.getIsDefault() != null && pvo.getIsDefault() == 1) {

				}else {
					Long prjLnkCompRlId = pvo.getId();
					prjLnkCompRemoveId = this.prjLnkCompRlPsnService.removeById(prjLnkCompRlId);
				}
			}

			// 查新挂靠公司变更记录信息
			PrjLnkCompApplyVO prjLnkCompApply = this.prjLnkCompApplyService.selectById(Long.valueOf(applyId));// 挂靠公司变更数据
			// 获取挂靠公司id
			Long prjLnkCompId = prjLnkCompApply.getPrjLnkCompId();

			PrjLnkCompApplyVO prjLnkCompApplyVo = new PrjLnkCompApplyVO();
			prjLnkCompApplyVo.setId(Long.valueOf(applyId));
			prjLnkCompApplyVo.setLnkCompNm(request.getParameter("lnkCompNm"));
			// prjLnkCompApplyVO.setMdfTm(new Date());// 更新时间
			prjLnkCompApplyVo.setMdfUsrIdB(prjLnkCompVO.getMdfUsrId());
			prjLnkCompApplyVo.setOrgCode(request.getParameter("orgCode"));
			prjLnkCompApplyVo.setPrjLnkCompId(Long.valueOf(prjLnkCompId));// 挂靠公司ID
			prjLnkCompApplyVo.setRem(prjLnkCompVO.getRem());// 备注
			// prjLnkCompApplyVO.setStatus();// 数据状态(是否最新0:否
			// 1:是)(SYS0021)
			prjLnkCompApplyVo.setTaxRegNo(request.getParameter("taxRegNo"));
			prjLnkCompApplyVo.setPrjLnkCompId(Long.valueOf(lnkCompId));
			prjLnkCompApplyVo.setBizLicNo(request.getParameter("bizLicNo"));
			prjLnkCompApplyVo.setCrtTm(new Date());
			prjLnkCompApplyVo.setCrtUsrId(prjLnkCompVO.getCrtUsrId());
			prjLnkCompApplyVo
					.setExpDt(DateUtils.formatStringToDate(request.getParameter("expDt"), DateUtils.YYYY_MM_DD));
			prjLnkCompApplyVo.setSucc(request.getParameter("succ")); //统一社会信用代码
			prjLnkCompApplyVo.setOwnerCd(request.getParameter("ownerCd"));//公司所属

			// 添加变更表数据
			this.prjLnkCompApplyService.modify(prjLnkCompApplyVo);

			// 关联人员变更信息
			PrjLcApplyRlPsnQueryCondition applyRlQc = new PrjLcApplyRlPsnQueryCondition();
			applyRlQc.setPrjLnkCompApplyId(Long.valueOf(applyId));
			List<PrjLcApplyRlPsnVO> applyRlList = this.prjLcApplyRlPsnService.searchList(applyRlQc);

			Map<String, PrjLcApplyRlPsnVO> map = new HashMap<String, PrjLcApplyRlPsnVO>();
			for (PrjLcApplyRlPsnVO pre : applyRlList) { // 关联人员变更表信息
				if (pre.getIsDefault() != null && pre.getIsDefault() == 1) {
					map.put(pre.getRlTypCd(), pre);
				}
			}

			for (PrjLnkCompRlPsnVO bak : bakList) { // 关联人员变更后
				if (bak.getIsDefault() != null && bak.getIsDefault() == 1) {
					PrjLcApplyRlPsnVO oldVo = map.get(bak.getRlTypCd());
					if (null != oldVo) {
						PrjLcApplyRlPsnVO rlvo = new PrjLcApplyRlPsnVO();
						rlvo.setId(oldVo.getId());
						rlvo.setPrjLnkCompApplyId(Long.valueOf(applyId));// 关联公司变更id
						rlvo.setRlTypCd(bak.getRlTypCd());// 关联类型-变更后
						rlvo.setRlNm(bak.getRlNm());// 姓名-变更后
						rlvo.setCertNo(bak.getCertNo());// 证件号码-变更后
						rlvo.setTel(bak.getTel());// 联系电话-变更后
						rlvo.setCertTypCd(bak.getCertTypCd());// 证件类型-变更后
						rlvo.setMdfTm(new Date());// 修改时间-变更后	
						rlvo.setBusInfoVerify("2");
						rlvo.setBrPerVerify("2");
						rlvo.setTdPerVerify("2");
						rlvo.setPyPerVerify("2");
						this.prjLcApplyRlPsnService.modify(rlvo);
					}else{
						if(StringUtils.isEmpty(bak.getId())){
							PrjLcApplyRlPsnVO rlvo = new PrjLcApplyRlPsnVO();
							rlvo.setPrjLnkCompApplyId(Long.valueOf(applyId));// 关联公司变更id
							rlvo.setRlTypCd(bak.getRlTypCd());// 关联类型-变更后
							rlvo.setRlNm(bak.getRlNm());// 姓名-变更后
							rlvo.setCertNo(bak.getCertNo());// 证件号码-变更后
							rlvo.setTel(bak.getTel());// 联系电话-变更后
							rlvo.setCertTypCd(bak.getCertTypCd());// 证件类型-变更后
							rlvo.setCrtTm(new Date());// 修改时间-变更后
							rlvo.setIsDefault(bak.getIsDefault());// 是否默认
							rlvo.setIsDel(BaseConstant.IS_YESNO_NO);
							rlvo.setIsValid(BaseConstant.IS_YESNO_YES);
							rlvo.setBusInfoVerify("2");
							rlvo.setPyPerVerify("2");
							rlvo.setBrPerVerify("2");
							rlvo.setTdPerVerify("2");
							Long add = this.prjLcApplyRlPsnService.add(rlvo);
						}
					}
				}
			}
			if (prjLnkCompId != null) {
				// 修改挂靠公司
				prjLnkCompVO.setId(Long.valueOf(prjLnkCompId));
				//流程结束前,关键字段不修改
				prjLnkCompVO.setLnkCompNm(prjLnkComp.getLnkCompNm());
				prjLnkCompVO.setSucc(prjLnkComp.getSucc());
				prjLnkCompVO.setExpDt(prjLnkComp.getExpDt());
				prjLnkCompVO.setOwnerCd(prjLnkComp.getOwnerCd());
				this.prjLnkCompService.modify(prjLnkCompVO);
				/*PrjLnkCompOrgRQC qc = new PrjLnkCompOrgRQC();
				qc.setLnkCompId(Long.valueOf(lnkCompId));
				qc.setBuOrgCd(CurrentThreadContext.getCurrentBuOrgCd());
				List<PrjLnkCompOrgRVO> rs = this.prjLnkCompOrgRService.searchList(qc);
				if (CollectionUtils.isEmpty(rs)) {
					PrjLnkCompOrgRVO prjLnkCompOrg = new PrjLnkCompOrgRVO();
					prjLnkCompOrg.setLnkCompId(Long.valueOf(lnkCompId));
					prjLnkCompOrg.setBuOrgCd(CurrentThreadContext.getCurrentBuOrgCd());
					this.prjLnkCompOrgRService.add(prjLnkCompOrg);
				}*/
				result.setSuccess(BaseConstant.IS_YESNO_YES);
				result.setInfo(SysLogConstant.LOG_CMM_UPDATE_SUCC);
			} else {
				// 获取页面参数
				prjLnkCompVO.setCrtTm(new Date());
				prjLnkCompVO.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
				prjLnkCompVO.setIsDel(BaseConstant.IS_YESNO_NO);
				prjLnkCompVO.setAudStsCd(PrjLnkCompRelInfoConstant.CODE_AUD_STS_NOT_AUDI_CD);// 获取默认的审核状态
				id = this.prjLnkCompService.add(prjLnkCompVO);
				PrjLnkCompOrgRQC qc = new PrjLnkCompOrgRQC();
				qc.setLnkCompId(id);
				qc.setBuOrgCd(CurrentThreadContext.getCurrentBuOrgCd());
				List<PrjLnkCompOrgRVO> rs = this.prjLnkCompOrgRService.searchList(qc);
				if (CollectionUtils.isEmpty(rs)) {
					PrjLnkCompOrgRVO prjLnkCompOrg = new PrjLnkCompOrgRVO();
					prjLnkCompOrg.setLnkCompId(id);
					prjLnkCompOrg.setBuOrgCd(CurrentThreadContext.getCurrentBuOrgCd());
					this.prjLnkCompOrgRService.add(prjLnkCompOrg);
				}
			}
			result.setData(id);
			BaseLogUtils.newWebLogger("新增挂靠公司数据").setLogOperType(LogOperEnum.RESP)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SQOT_MANAGER_CD)
					.setWarning(false)
					.setKeys("result", JSON.toJSONString(result))
					.info();
		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.newWebLogger("新增挂靠公司数据失败,业务异常").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SQOT_MANAGER_CD)
					.setWarning(false)
					.setThrowable(ex)
					.warn(LogExceptionEnum.COMMON_CODE_0001);
		} catch (Exception ex) {
			ex.printStackTrace();
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.newWebLogger("新增挂靠公司数据失败,系统异常").setLogOperType(LogOperEnum.REQ)
					.setSysCd(CurrentThreadContext.getCurrentSysCd())
					.setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
					.setBussinessId(BusinessIdConstant.LOG_SQOT_MANAGER_CD)
					.setWarning(false)
					.setThrowable(ex)
					.error(LogExceptionEnum.COMMON_CODE_0099);
		}
		return result;

	}
}
